ulasozguler / sublime-url-utils

Sublime Text 3 plugin for url stuff.
10 stars 3 forks source link

URL parse treats semicolons `;` as query param separators #2

Open digeomel opened 2 months ago

digeomel commented 2 months ago

Hello, I know this plugin is old and probably abandoned, but I just noticed what I consider a bug, specifically, it seems to split URL query params not only on the ampersand & (to be precise, ampersand not followed by a hex code), but also on the semicolon ;.

I looked at the code and it seems to be caused by the use of the Python urllib, as described in this question:

https://stackoverflow.com/questions/5158565/why-does-pythons-urlparse-parse-qs-split-arguments-on-semicolon

Looking into the code, it seems that the plugin uses the urllib.parse.urlparse function:

https://github.com/ulasozguler/sublime-url-utils/blob/b6a79232a64eb2063ecb09e657deb4962fa920e6/urlutils.py#L65

which doesn't accept options for the separators, while the urllib.parse.parse_qs and urllib.parse.parse_qsl functions do, and it defaults to only the ampersand, as it should:

https://docs.python.org/3/library/urllib.parse.html

So, any chance this might be updated?

Thanks in advance!

ulasozguler commented 2 months ago

Hi,

As you have guessed, I'm not really maintaining this plugin anymore. I'm not even using Sublime text. If you create a PR that fixes the problem, I can publish a new version. But I don't intend to look into this myself.

If you are also using VS Code, I ported this plugin to there too. It doesn't have the problem you mentioned. plugin page | source code

digeomel commented 2 months ago

Thank you for your reply. I use vscode as my main IDE, but I still use Sublime Text as a lightweight editor for simple things such as this. I will check your vscode extension.

In the meantime, I am not a Python developer, but I have been wanting to learn for a long time now, and this looks like a nice way to do it 😄 If nobody else picks it up before me, maybe I will make a PR in my free time.