Hash parsing optimized
This commit is contained in:
parent
15772da2e8
commit
a487770622
@ -12,9 +12,12 @@ export function generateProxyUrl(
|
|||||||
engine?: string
|
engine?: string
|
||||||
): string {
|
): string {
|
||||||
const parsedHref = new URL(href);
|
const parsedHref = new URL(href);
|
||||||
const hrefWithoutHash = href.replace(parsedHref.hash, "");
|
|
||||||
|
|
||||||
const urlParam = `?url=${encodeURIComponent(hrefWithoutHash)}`;
|
const hash = parsedHref.hash; // save #hash
|
||||||
|
parsedHref.hash = ""; // remove
|
||||||
|
|
||||||
|
const urlParam = `?url=${encodeURIComponent(parsedHref.toString())}`;
|
||||||
const engineParam = engine ? `&engine=${engine}` : "";
|
const engineParam = engine ? `&engine=${engine}` : "";
|
||||||
return `${requestUrl.origin}/get${urlParam}${engineParam}${parsedHref.hash}`;
|
|
||||||
|
return `${requestUrl.origin}/get${urlParam}${engineParam}${hash}`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user