[FIX] Parse Urls (#1371)

This commit is contained in:
Djorkaeff Alexandre 2019-11-07 09:35:04 -03:00 committed by Diego Mello
parent e0f0f99990
commit 38523509e0
1 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,11 @@ export default urls => urls.filter(url => url.meta && !url.ignoreParse).map((url
decodedOgImage = meta.ogImage.replace(/&/g, '&');
}
tmp.image = decodedOgImage || meta.twitterImage || meta.oembedThumbnailUrl;
if (tmp.image.indexOf('//') === 0) {
tmp.image = `${ url.parsedUrl.protocol }${ tmp.image }`;
} else if (tmp.image.indexOf('/') === 0 && (url.parsedUrl && url.parsedUrl.host)) {
tmp.image = `${ url.parsedUrl.protocol }//${ url.parsedUrl.host }${ tmp.image }`;
}
tmp.url = url.url;
return tmp;
});