MCPcopy Create free account
hub / github.com/error311/FileRise / normalizeUrl

Function normalizeUrl

public/js/main.js:611–623  ·  view source on GitHub ↗
(u)

Source from the content-addressed store, hash-verified

609 const IGNORE_QUERY_KEYS = new Set(['t', '_', 'cache']);
610
611 function normalizeUrl(u) {
612 try {
613 const url = new URL(u, window.location.origin);
614 // Keep path + stable query ordering
615 const params = new URLSearchParams(url.search);
616 const sorted = new URLSearchParams();
617 [...params.keys()].sort().forEach(k => {
618 if (IGNORE_QUERY_KEYS.has(k)) return;
619 sorted.set(k, params.get(k));
620 });
621 return url.pathname + (sorted.toString() ? '?' + sorted.toString() : '');
622 } catch (e) { return String(u || ''); }
623 }
624
625 async function toStableBody(init) {
626 const b = init && init.body;

Callers 1

main.jsFile · 0.85

Calls 2

setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected