Merge pull request #33 from TxtDot/fix-hashes

fix: hashlinks
This commit is contained in:
Andrey 2023-08-19 21:28:53 +04:00 committed by GitHub
commit 834c8ef23a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,10 @@ export function generateProxyUrl(
href: string,
engine?: string
): string {
const urlParam = `?url=${encodeURIComponent(href)}`;
const parsedHref = new URL(href);
const hrefWithoutHash = href.replace(parsedHref.hash, "");
const urlParam = `?url=${encodeURIComponent(hrefWithoutHash)}`;
const engineParam = engine ? `&engine=${engine}` : "";
return `${requestUrl.origin}/get${urlParam}${engineParam}`;
return `${requestUrl.origin}/get${urlParam}${engineParam}${parsedHref.hash}`;
}