Open Bug 1840289 Opened 11 months ago Updated 8 months ago

When opening firefox with URL argument, it doesn't URL encode illegal characters, if I open the same URL from address bar in Firefox it works.

Categories

(Toolkit :: Startup and Profile System, defect)

Firefox 116
defect

Tracking

()

UNCONFIRMED

People

(Reporter: robin.seinen98, Unassigned)

Details

Attachments

(2 files)

Attached image Untitled.png

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

Steps to reproduce:

This is tested on Windows 11, Firefox Nightly 116a.

  1. Make shortcut on desktop to URL https://httpbin.org/anything?q={"json":"value"}
  2. Click shortcut
  3. Read output of httpbin

Actual results:

The characters in the query param are not encoded but stripped from the URL, which you can read from the body of the website.

Firefox shows this (the JSON is missing its quotes):

"args": {
"q": "{json:value}"
}

Expected results:

Other browsers I've tested (Chrome, Edge) return the right response and expected result:

"args": {
"q": "{"json":"value"}"

I believe Firefox should URL encode the quotes and other illegal characters instead of stripping them.

For questions please let me know, this is my first bug report for Firefox.

Hello, thank you for the bug report!
Unfortunately I could not reproduce your issue. On Nightly 116.0a1 on my end the JSON is shown as follows: ‘{“json”:“value”}’
Would you be so kind as to answer a few questions so we can investigate this further?

Moving the Component to 'General'. Please change if there's a better fit, thank you.

Component: Untriaged → General
Flags: needinfo?(robin.seinen98)
Attached file about:support info
Yes, it does happen with a new profile.

Maybe it's Windows specific? I don't know. Quotes sometimes present problems on different OS.

It happens with Troubleshoot mode enabled too.

Flags: needinfo?(robin.seinen98)
Component: General → Startup and Profile System
Product: Firefox → Toolkit

Thanks for filing this, it's definitely interesting (to me anyway). I had a quick look, and I suspect there may be something in how the command line is being conveyed to us by the shell that is different from what we expect; the parameter that we are receiving is -url "https://httpbin.org/anything?q={"json":"value"}", and I'm not at all certain we're going to know what to do with all those unescaped quotes.

Robin, can you provide any more detail as to how you're creating these shortcut files? That could help us pin down where the difference vs. Chrome's behavior is coming from, which is the part I think we most need to resolve.

Flags: needinfo?(robin.seinen98)

I can add a little context, since this originated from my repo. We're using Window's default URL launcher like so:
https://github.com/dotMorten/WinUIEx/blob/f2fbdf89323ae532c66d611222458d28be542e86/src/WinUIEx/WebAuthenticator.cs#L261-L266

It appears only with Firefox the URL gets the query string mangled, whereas Edge and Chrome has no issue with this approach. Since the code has no knowledge of which browser is the system default, it is the exact same code regardless of browser, and there's an expectation of the same data gets accross the same way.

Here's how I managed to repro the above. On Windows set your default browser to Edge. Then open the Run menu with Win+R. Paste in https://httpbin.org/anything?q={"json":"value"} and hit enter.
Notice that the last value in the opened URL shows quotes escaped: "url": "https://httpbin.org/anything?q={\"json\":\"value\"}"

Next set the browser to FireFox and repeat the steps opening the url from the Run menu. After switching to the Raw Data tab, now notice that the url shows: "url": "https://httpbin.org/anything?q={json:value}" (without the escaped quotes)

(In reply to Molly Howell (she/her) [:mhowell] from comment #4)

Thanks for filing this, it's definitely interesting (to me anyway). I had a quick look, and I suspect there may be something in how the command line is being conveyed to us by the shell that is different from what we expect; the parameter that we are receiving is -url "https://httpbin.org/anything?q={"json":"value"}", and I'm not at all certain we're going to know what to do with all those unescaped quotes.

Robin, can you provide any more detail as to how you're creating these shortcut files? That could help us pin down where the difference vs. Chrome's behavior is coming from, which is the part I think we most need to resolve.

Morten is right. The way I found out about this is by starting the URL from Windows in a .NET MAUI app, that invokes the default Windows URL launcher with default browser set to Firefox.

The reason I tried it with a shortcut is because I thought that would be easier to explain and it works the same since both use the Windows URL handler. I'm creating the shortcuts by the Windows context menu (right-click, new, shortcut).

Flags: needinfo?(robin.seinen98)

The severity field is not set for this bug.
:mossop, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(dtownsend)
Severity: -- → S3
Flags: needinfo?(dtownsend)

I'm not at all certain we're going to know what to do with all those unescaped quotes.

@mhowell
These don't need to be escaped. What you need to do is nothing, just like you do if you take that URL and just paste it into the address bar. Something in firefox is clearly stripping them away before opening up the URL in the address bar.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: