0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00

🐛 Fixed bookmark card creation and pasted link unfurls (#17990)

no issue

- recently added code to grab apple touch icons or SVGs before falling back to the default metascraper behaviour wrongly assumed that every size would have a `rel` and `href` attribute which is not the case
This commit is contained in:
Kevin Ansfield 2023-09-06 11:22:45 +01:00 committed by GitHub
parent 95c63e16c9
commit 309184f5da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -208,8 +208,8 @@ class OEmbedService {
const pickFn = (sizes, pickDefault) => {
// Prioritize apple touch icon with sizes > 180
const appleTouchIcon = sizes.find(item => item.rel.includes('apple') && item.sizes && item.size.width >= 180);
const svgIcon = sizes.find(item => item.href.endsWith('svg'));
const appleTouchIcon = sizes.find(item => item.rel?.includes('apple') && item.sizes && item.size.width >= 180);
const svgIcon = sizes.find(item => item.href?.endsWith('svg'));
return appleTouchIcon || svgIcon || pickDefault(sizes);
};