[FIX] Parse image URL only if it's not empty (#1372)
This commit is contained in:
parent
38523509e0
commit
5e4ce8feac
|
@ -9,11 +9,13 @@ export default urls => urls.filter(url => url.meta && !url.ignoreParse).map((url
|
||||||
decodedOgImage = meta.ogImage.replace(/&/g, '&');
|
decodedOgImage = meta.ogImage.replace(/&/g, '&');
|
||||||
}
|
}
|
||||||
tmp.image = decodedOgImage || meta.twitterImage || meta.oembedThumbnailUrl;
|
tmp.image = decodedOgImage || meta.twitterImage || meta.oembedThumbnailUrl;
|
||||||
|
if (tmp.image) {
|
||||||
if (tmp.image.indexOf('//') === 0) {
|
if (tmp.image.indexOf('//') === 0) {
|
||||||
tmp.image = `${ url.parsedUrl.protocol }${ tmp.image }`;
|
tmp.image = `${ url.parsedUrl.protocol }${ tmp.image }`;
|
||||||
} else if (tmp.image.indexOf('/') === 0 && (url.parsedUrl && url.parsedUrl.host)) {
|
} else if (tmp.image.indexOf('/') === 0 && (url.parsedUrl && url.parsedUrl.host)) {
|
||||||
tmp.image = `${ url.parsedUrl.protocol }//${ url.parsedUrl.host }${ tmp.image }`;
|
tmp.image = `${ url.parsedUrl.protocol }//${ url.parsedUrl.host }${ tmp.image }`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
tmp.url = url.url;
|
tmp.url = url.url;
|
||||||
return tmp;
|
return tmp;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue