fix: hashlinks

This commit is contained in:
Artemy Egorov 2023-08-19 20:03:15 +03:00
parent d3186be26d
commit fce41748d5

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}`;
}