Closed Bug 1818970 Opened 2 years ago Closed 2 years ago

character ' is not encoded in Copy Link

Categories

(Firefox :: Menus, defect)

Firefox 110
Desktop
Windows 11
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: 15063662, Unassigned)

Details

Attachments

(1 file)

Attached image output.gif

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

Steps to reproduce:

On left menu of the page https://en.wikipedia.org/wiki/Laplace%27s_method

<a class="vector-toc-link" href="#Laplace's_method_generalization:_Median-point_approximation">
			<div class="vector-toc-text">
			<span class="vector-toc-numb">6</span>Laplace's method generalization: Median-point approximation</div>
		</a>

the URL contains ' character
Right click the link and execute Copy link

Actual results:

' character is not encoded (but copying from the address bar, it will be encoded to %27)

Expected results:

It should be encoded to %27

The Bugbug bot thinks this bug should belong to the 'Firefox::Address Bar' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Address Bar
Component: Address Bar → General
Component: General → Menus

I actually can't seem reproduce this on Windows. 15063662, what is the exact page that you're copying from in the animated GIF? Also, do you have any add-ons that might be adding to or augmenting the behaviour of the context menu?

Flags: needinfo?(15063662)

(In reply to Mike Conley (:mconley) (:⚙️) from comment #2)

I actually can't seem reproduce this on Windows. 15063662, what is the exact page that you're copying from in the animated GIF? Also, do you have any add-ons that might be adding to or augmenting the behaviour of the context menu?

Hello, I was copying on this page: https://math.stackexchange.com/questions/1128367
There are two links containing '
<a href="http://en.wikipedia.org/wiki/Wallis'_integrals" rel="nofollow">Wallis' integrals</a>
and
<a href="http://en.wikipedia.org/wiki/Liouville's_theorem_(differential_algebra)" rel="nofollow">Liouville's theorem</a>

When I click "copy link" in the menu, the result is
http://en.wikipedia.org/wiki/Wallis'_integrals
http://en.wikipedia.org/wiki/Liouville's_theorem_(differential_algebra)

' character is not encoded.

Flags: needinfo?(15063662)
OS: Unspecified → Windows 11
Hardware: Unspecified → Desktop

Perhaps this is not a bug? Chrome also doesn't encode ' to %27 if the link itself contains '

Hey smaug, maybe you know, or maybe you know who we can ask: is there some kind of web-specification behaviour that we should follow when copying URLs with these kinds of characters? Or are Firefox and Chrome doing the right thing here?

Flags: needinfo?(smaug)

I don't think there is any spec, but hsivonen might have some opinion on the behavior.

Flags: needinfo?(smaug) → needinfo?(hsivonen)

AFAICT, the relevant part of the spec is https://url.spec.whatwg.org/#path-state . We end up in the "Otherwise" step. Substep 1. ' is a URL code point, so there's no error in substep 1. ' is not %, so we skip substep 2. Therefore, in step 3, we UTF-8 percent encode ' with path percent-encode set. Since ' is not in the path percent-encode set, it passes through without percent encoding.

AFAICT, there's no bug here

but copying from the address bar, it will be encoded to %27)

I don't see this on Linux. Following the link from comment 1, pressing ctrl-l, ctrl-c, and pasting into gedit shows unescaped '.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Flags: needinfo?(hsivonen)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: