Fix TypeError due to invalid URL (#1206)

This commit is contained in:
ekzyis 2024-05-29 08:26:42 -05:00 committed by GitHub
parent 738333efa3
commit 30718b9e1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 31 additions and 28 deletions

View File

@ -244,8 +244,8 @@ export default memo(function Text ({ rel, imgproxyUrls, children, tab, itemId, o
paddingRight: '15px'
}
try {
const { provider, id, meta } = parseEmbedUrl(href)
// Youtube video embed
if (provider === 'youtube') {
return (
@ -275,6 +275,9 @@ export default memo(function Text ({ rel, imgproxyUrls, children, tab, itemId, o
</div>
)
}
} catch {
// ignore invalid URLs
}
// assume the link is an image which will fallback to link if it's not
return <Img src={href} rel={rel ?? UNKNOWN_LINK_REL} {...props}>{children}</Img>