Closed Bug 1843717 Opened 10 months ago Closed 3 months ago

Backlashes in URL are changed to slashes when page is loaded from local file

Categories

(Core :: Networking: File, defect, P3)

Firefox 115
defect

Tracking

()

VERIFIED FIXED
124 Branch
Tracking Status
firefox124 --- verified

People

(Reporter: mvorisek, Assigned: valentin)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0

Steps to reproduce:

Let's have a file test.html with:

<a href="foo#x\y">test</a>

and save it on local filesystem.

Now open the file in Firefox from local filesystem and hover the link. Notice the target URL.

Actual results:

Notice, the target URL is "file://...foo#x/y". (notice the "" in the fragment changed to "/").

This happen only when the file is opened from local filesystem. When opened from regular webserver/http/https, this issue is not present.

Also I am only Windows. On linux, I cannot test.

Expected results:

The URL fragment must never be normalized.

I expect "file://...foo#x\y" URL on hover and also when clicked.

Can someone please confirm this issue and fix it?

I've reproduced this issue in the latest Nightly 118.0a1 and Firefox 116.0 versions on Windows 10 x64.
Setting the component and waiting for the developer's opinion about it.
If this is not the correct component, please feel free to change it to a more appropriate one.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Component: Untriaged → Networking: File
Ever confirmed: true
Product: Firefox → Core
Blocks: url
Priority: -- → P3
Whiteboard: [necko-triaged]

This bug seems to have existed since bug 249282
The probem was that on windows we wanted to normalize the path of the
file URLs. When doing that bug 249282 also started normalizing the
inputs of relative file URLs, such that it triggers this bug.

When normalizing the input, the normalization should have stopped at the
'#' character. This patch fixes net_NormalizeFileURL to address that.

Since file URLs are only ever parsed with nsStandardURL and this
implementation already normalizes file paths for all special schemes
(file, http, https, etc) calling net_NormalizeFileURL before creating
a file URL is no longer needed, so we can remove the call in
NS_NewURI entirely.

Assignee: nobody → valentin.gosu
Status: NEW → ASSIGNED
Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/5eb08718b0d7
Don't replace backslashes in the hash of the URL r=necko-reviewers,kershaw
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 124 Branch
Regressions: 1877606

I can no longer reproduce this issue in the latest Nightly 124.0a1 on Windows 10 x64 and Ubuntu 22.04.
Marking as VERIFIED FIXED.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: