Spaces:
Running
Running
assafvayner HF Staff
fix(auth): gate admin routes on the decoded path and in the actions themselves
857fbc2 | /** | |
| * Decode a URL pathname the way SvelteKit does before matching routes: every | |
| * segment between literal `%25` sequences is decoded, so `/%61dmin` becomes | |
| * `/admin`. Throws `URIError` on a malformed escape sequence. | |
| */ | |
| export function decodePathname(pathname: string): string { | |
| return pathname.split('%25').map(decodeURIComponent).join('%25'); | |
| } | |