tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 8ce23df3d474357346226be518dd9f2fd6e35796
parent 62562804a469f1393ba6984ff5cffd1031c2410d
Author: Pier Angelo Vendrame <pierov@torproject.org>
Date:   Tue,  3 Sep 2024 19:55:05 +0200

BB 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.

Diffstat:
Mdocshell/base/URIFixup.sys.mjs | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/docshell/base/URIFixup.sys.mjs b/docshell/base/URIFixup.sys.mjs @@ -927,6 +927,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 {