Procházet zdrojové kódy

Merge pull request #4383 from milkey-mouse/fix-4133

Only modify window.location when redirecting
TW před 6 roky
rodič
revize
5ba14e8d95
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4 1
      docs/usage.rst

+ 4 - 1
docs/usage.rst

@@ -17,7 +17,10 @@ Usage
 
    // Redirect to general docs
    if(hash == "") {
-       window.location.pathname = window.location.pathname.replace("usage.html", "usage/general.html");
+       var replaced = window.location.pathname.replace("usage.html", "usage/general.html");
+       if (replaced != window.location.pathname) {
+           window.location.pathname = replaced;
+       }
    }
    // Fixup anchored links from when usage.html contained all the commands
    else if(hash.startsWith("borg-key") || hash == "borg-change-passphrase") {