osolmaz HF Staff commited on
Commit
e3726e8
·
verified ·
1 Parent(s): 7614202

fix: canonicalize shared URL paths

Browse files
Files changed (1) hide show
  1. src/main.ts +1 -0
src/main.ts CHANGED
@@ -129,6 +129,7 @@ function currentShareState(config = readConfig()): ShareState {
129
 
130
  function canonicalUrl(config = readConfig()): URL {
131
  const url = new URL(window.location.href);
 
132
  url.search = encodeShareState(currentShareState(config));
133
  url.hash = "";
134
  return url;
 
129
 
130
  function canonicalUrl(config = readConfig()): URL {
131
  const url = new URL(window.location.href);
132
+ if (url.pathname.endsWith("/index.html")) url.pathname = url.pathname.slice(0, -"index.html".length);
133
  url.search = encodeShareState(currentShareState(config));
134
  url.hash = "";
135
  return url;