fix(ui): use div for fragment, check lastfm url for artist page (#4980)

* fix(ui): use div for fragment, check lastfm url for artist page

* use span instead of div for better compat

* fix: implement isLastFmURL utility and add tests for URL validation

---------

Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Kendall Garner 2026-02-04 22:34:26 +00:00 • committed by GitHub
commit 2731e25fd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 43 additions and 5 deletions

View file

@ -1,5 +1,5 @@
import DOMPurify from 'dompurify'
import { Fragment, useMemo } from 'react'
import { useMemo } from 'react'
export const SafeHTML = ({ children }) => {
const purified = useMemo(() => {
@ -23,5 +23,5 @@ export const SafeHTML = ({ children }) => {
return purify.sanitize(children, { ADD_ATTR: ['referrer-policy'] })
}, [children])
return <Fragment dangerouslySetInnerHTML={{ __html: purified }} />
return <span dangerouslySetInnerHTML={{ __html: purified }} />
}