Skip to content

Commit 4b40c05

Browse files
committed
libremdb: Redirect to homepage for unsupported URLs #1059
1 parent 92f12f8 commit 4b40c05

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/assets/javascripts/services.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,10 @@ function rewrite(url, originUrl, frontend, randomInstance, type) {
465465
return `${randomInstance}${url.pathname}${url.search}`
466466
}
467467
case "libremdb": {
468-
if (url.pathname.startsWith("/Name")) {
469-
for (const [key, value] of url.searchParams.entries()) {
470-
return `${randomInstance}/title/${encodeURIComponent(key)}`
471-
}
468+
if (/\/((?:name|title)\/\w+)\/?$/.exec(url.pathname)) {
469+
return `${randomInstance}${url.pathname}${url.search}`
472470
}
473-
return `${randomInstance}${url.pathname}${url.search}`
471+
return randomInstance
474472
}
475473
case "tuboYoutube":
476474
url.searchParams.delete("si")

0 commit comments

Comments
 (0)