소스 검색

Only modify window.location when redirecting (fixes #4133)

window.location.pathname = window.location.pathname can trigger a redirect,
which created a refresh loop in usage.html.
Milkey Mouse 6 년 전
부모
커밋
7ea2bd1389
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      docs/usage.rst

+ 4 - 1
docs/usage.rst

@@ -17,7 +17,10 @@ Usage
 
 
    // Redirect to general docs
    // Redirect to general docs
    if(hash == "") {
    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
    // Fixup anchored links from when usage.html contained all the commands
    else if(hash.startsWith("borg-key") || hash == "borg-change-passphrase") {
    else if(hash.startsWith("borg-key") || hash == "borg-change-passphrase") {