All users were logged out of Bugzilla on October 13th, 2018

Navigating to local file through a (local) symlink strips query (?a=b) and fragment identifier (#anchor) from the link

RESOLVED FIXED in Firefox 45, Firefox OS v2.5

Status

()

RESOLVED FIXED
6 years ago
3 years ago

People

(Reporter: megan.smith, Assigned: billm)

Tracking

({regression})

15 Branch
mozilla45
x86_64
Linux
regression
Points:
---

Firefox Tracking Flags

(firefox45 fixed, b2g-v2.5 fixed)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31

Steps to reproduce:

1) Create a local html file that is a symlink to a source local html file.
2) In the URL bar, type file://<path to symlink>#<an anchor in the source file>
3) Hit enter


Actual results:

Firefox navigates to the beginning of the source file, minus the anchor link.


Expected results:

Firefox navigates to the correct anchor in the source file.

Comment 1

6 years ago
Confirmed with 2013-05-06-03-09-25-mozilla-central-firefox-23.0a1.ru.linux-x86_64.
Status: UNCONFIRMED → NEW
Depends on: 670514
Ever confirmed: true

Updated

6 years ago
Summary: Navigating to local symlinked file with an anchor link strips anchor link → Navigating to local file through a (local) symlink strips anchor from the link

Comment 2

6 years ago
Since Fx 15: https://bugzilla.mozilla.org/show_bug.cgi?id=670514#c63
Version: 16 Branch → 15 Branch

Comment 3

4 years ago
(In reply to [:Aleksej] from comment #2)
> Since Fx 15: https://bugzilla.mozilla.org/show_bug.cgi?id=670514#c63

-g 2012-05-03-03-05-12-mozilla-central-firefox-15.0a1.en-US.linux-x86_64 807403a04a6a
-b 2012-05-04-12-29-39-mozilla-central-firefox-15.0a1.en-US.linux-x86_64 9ebf3dc839c5
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=807403a04a6a&tochange=9ebf3dc839c5

-b 2015-03-30-03-02-03-mozilla-central-firefox-39.0a1.ru.linux-x86_64
Blocks: 670514
Component: Untriaged → Networking: File
No longer depends on: 670514
Keywords: regression
Product: Firefox → Core
See Also: → bug 1051117

Updated

4 years ago
See Also: → bug 1148173
Summary: Navigating to local file through a (local) symlink strips anchor from the link → Navigating to local file through a (local) symlink strips fragment identifier (anchor) from the link
This still reproduces in Firefox Nightly 39, FWIW. (I just tried it with a file in /tmp and a symlink to that file.)
Duplicate of this bug: 1148173
See Also: bug 1148173
As noted in bug 1051117 comment 17, the symlink translation-to-actual-file happens in  nsFileChannel::nsFileChannel() -- that's where we lose the fragment identifier (and anything else after the filename).

MXR link: http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/file/nsFileChannel.cpp?rev=ac4464790ec4&mark=260-269#260

There, 'uri' (and hence 'fileURL') has the fragment identifier, but 'targetURI' (produced by the long 'if' statement) does not -- and that's the problem.

Updated

4 years ago
Summary: Navigating to local file through a (local) symlink strips fragment identifier (anchor) from the link → Navigating to local file through a (local) symlink strips query (?a=b) and fragment identifier (#anchor) from the link
Assignee: nobody → netzen
I won't have time for this in the near future so unassigned myself for now.
Created attachment 8634798 [details] [diff] [review]
patch

This fixes the problem I was experiencing with a test not running locally.
Assignee: netzen → wmccloskey
Status: NEW → ASSIGNED
Attachment #8634798 - Flags: review?(sworkman)
Comment on attachment 8634798 [details] [diff] [review]
patch

Review of attachment 8634798 [details] [diff] [review]:
-----------------------------------------------------------------

Looks sane to me. Can we get a try run for this before landing please? Pending that and the naming nit, r=me.

::: netwerk/protocol/file/nsFileChannel.cpp
@@ +276,5 @@
> +    nsCOMPtr<nsIURL> origURL = do_QueryInterface(uri);
> +    nsCOMPtr<nsIURL> targetURL = do_QueryInterface(targetURI);
> +    nsAutoCString search;
> +    if (origURL && targetURL && NS_SUCCEEDED(origURL->GetQuery(search))) {
> +      targetURL->SetQuery(search);

s/search/queryString/
Attachment #8634798 - Flags: review?(sworkman) → review+

Comment 11

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/16ab2ae184c0
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox45: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.