support pathname in logo URL in branding page

This commit is contained in:
Fred KISSIE
2026-01-28 03:04:12 +01:00
parent 12aea2901d
commit ed3ee64e4b
6 changed files with 102 additions and 22 deletions

View File

@@ -0,0 +1,16 @@
export function validateLocalPath(value: string) {
try {
const url = new URL("https://pangoling.net" + value);
if (
url.pathname !== value ||
value.includes("..") ||
value.includes("*")
) {
throw new Error("Invalid Path");
}
} catch {
throw new Error(
"should be a valid pathname starting with `/` and not containing query parameters, `..` or `*`"
);
}
}