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
parent 4f3845bbe3
commit 2731e25fd2
4 changed files with 43 additions and 5 deletions
+13
View File
@@ -44,3 +44,16 @@ export const shareCoverUrl = (id, square) => {
}
export const docsUrl = (path) => `https://www.navidrome.org${path}`
export const isLastFmURL = (url) => {
try {
const parsed = new URL(url)
return (
(parsed.protocol === 'http:' || parsed.protocol === 'https:') &&
(parsed.hostname === 'last.fm' || parsed.hostname.endsWith('.last.fm')) &&
parsed.pathname.startsWith('/music/')
)
} catch (e) {
return false
}
}