pl-fe: fix crash on urls with undefined href

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2025-03-21 01:00:19 +01:00
parent 7cd895ef47
commit a324eb4492

View File

@ -111,11 +111,13 @@ function parseContent({
if (domNode.name === 'a') {
const classes = domNode.attribs.class?.split(' ');
const href = domNode.attribs.href && cleanUrls ? Purify.clearUrl(domNode.attribs.href) : domNode.attribs.href;
const fallback = (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<a
{...domNode.attribs}
href={cleanUrls ? Purify.clearUrl(domNode.attribs.href) : domNode.attribs.href}
href={href}
onClick={(e) => e.stopPropagation()}
rel='nofollow noopener noreferrer'
target='_blank'