diff --git a/src/components/markdown/markdown.tsx b/src/components/markdown/markdown.tsx index 6fc19b21..bb79e537 100644 --- a/src/components/markdown/markdown.tsx +++ b/src/components/markdown/markdown.tsx @@ -179,17 +179,21 @@ const Markdown = ({ content, title }: MarkdownProps) => { source: ({ src }) => {src}, a: ({ href, children }) => { if (href && !isInCatalogView) { - const linkMediaInfo = getLinkMediaInfo(href); - const embedUrl = new URL(href); - if (canEmbed(embedUrl) || getHasThumbnail(linkMediaInfo, href)) { - return ; - } else { - return ( - - {children} - - ); + try { + const linkMediaInfo = getLinkMediaInfo(href); + const embedUrl = href.startsWith('http') ? new URL(href) : null; + if ((embedUrl && canEmbed(embedUrl)) || getHasThumbnail(linkMediaInfo, href)) { + return ; + } + } catch (e) { + console.debug('Invalid URL:', href); } + + return ( + + {children} + + ); } }, }}