dont encode hash part of url

This commit is contained in:
Percs 2025-04-19 12:03:14 -05:00
parent 5c4d013e16
commit 4791bf0ca8

View file

@ -46,11 +46,14 @@ export function rewriteUrl(url: string | URL, meta: URLMeta) {
if (base.startsWith("about:")) base = unrewriteUrl(self.location.href); // jank!!!!! weird jank!!!
const realUrl = tryCanParseURL(url, base);
if (!realUrl) return url;
const hash = realUrl.hash;
realUrl.hash = "";
return (
location.origin +
$scramjet.config.prefix +
$scramjet.codec.encode(realUrl.href)
$scramjet.codec.encode(realUrl.href) +
hash
);
}
}