File size: 354 Bytes
857fbc2
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
/**
 * 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');
}