Verified Commit 48273514 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by ma1
Browse files

Bug 42773: Replace ~ with the original home.

In Bug 93141, Mozilla started sending users to their home when they type
~ in the URL bar.
On Linux, we change $HOME for various reason, therefore you would be
redirected to the spoofed home directory when typing ~.
So, we check if the original home directory is known, and use that,
instead.
parent e38453bc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -934,6 +934,10 @@ function fileURIFixup(uriString) {
  } else {
    // UNIX: Check if it starts with "/" or "~".
    attemptFixup = /^[~/]/.test(uriString);
    const originalHome = Services.env.get("BB_ORIGINAL_HOME");
    if (originalHome && (uriString === "~" || uriString.startsWith("~/"))) {
      path = originalHome + path.substring(1);
    }
  }
  if (attemptFixup) {
    try {