Skip to content

Commit

Permalink
[core] store content_length in root of link object (was in .media att…
Browse files Browse the repository at this point in the history
…ribute)
  • Loading branch information
nleush committed Jul 13, 2015
1 parent d7908de commit 8fdd8a1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/oembed.js
Expand Up @@ -84,9 +84,9 @@ exports.getOembed = function(uri, data, options) {
if (m.height) {
oembed.height = m.height;
}
if (m.content_length) {
oembed.content_length = m.content_length;
}
}
if (link) {
oembed.content_length = link.content_length;
}

if (link && !inlineReader) {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/validators/async/22_imageSize.js
Expand Up @@ -67,7 +67,7 @@ module.exports = {
};

if (data.content_length) {
link._imageMeta.content_length = data.content_length;
link.content_length = data.content_length;
}
}

Expand Down
4 changes: 0 additions & 4 deletions lib/plugins/validators/media.js
Expand Up @@ -78,10 +78,6 @@ function moveMediaAttrs(link) {
m.height = link._imageMeta.height;
link.type = "image/" + link._imageMeta.type.toLowerCase();
}

if (_imageMeta.content_length) {
m.content_length = link._imageMeta.content_length;
}
}

if (!isEmpty(m)) {
Expand Down
5 changes: 5 additions & 0 deletions lib/plugins/validators/sync/07_duplicateLink.js
Expand Up @@ -66,6 +66,11 @@ module.exports = {
// Merge unique rels.
storedLink.rel = _.union(link.rel || [], storedLink.rel || []);

// Store content_length.
if (storedLink.content_length || link.content_length) {
storedLink.content_length = storedLink.content_length || link.content_length;
}

// Set error to new link to remove it from result.
if (link.href !== storedLink.href && storedLink.href !== linkNoProtocol) {

Expand Down

0 comments on commit 8fdd8a1

Please sign in to comment.