Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] URL escaped UTF-8 code units get de-encoded #975

Open
brolaugh opened this issue Jun 8, 2018 · 13 comments
Open

[Bug] URL escaped UTF-8 code units get de-encoded #975

brolaugh opened this issue Jun 8, 2018 · 13 comments
Labels
B-bug Bug: general classification S-verified Status: Verified by maintainer

Comments

@brolaugh
Copy link

brolaugh commented Jun 8, 2018

  • Insomnia Version: 5.16.6
  • Operating System: Windows 10

Details

I'm using query params to send a request towards an API but the URL isn't rendered how I want it to.
This is what I'm trying to achive using the query tab in in the request:

 https://example.com?text=%4E%C3%A4%72%20%6D%61%6E%20%74%65%73%74%61%72%20%74%65%73%74%61%72%20%6D%61%6E

But gets transformed into:

https://example.com?text=N%C3%A4r%20man%20testar%20testar%20man

I'm using a service that requires me to make the request in the first format and so I can't test this service using Insomnia.

@welcome
Copy link

welcome bot commented Jun 8, 2018

👋 Thanks for opening your first issue! If you're reporting a 🐞 bug, please make sure
you include steps to reproduce it. If you're requesting a feature 🎁, please provide real
use cases that would benefit. 👪

To help make this a smooth process, please be sure you have first read the
contributing guidelines.

@theodorejb
Copy link

I also ran into an issue where the % character isn't escaped when used in a query value (it should be escaped as %25). So if I use a query value that starts wtih %ba, I get a server error because the value is decoded as binary data rather than the literal string '%ba'.

@stale
Copy link

stale bot commented Aug 11, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Bot: Stale Issue label Aug 11, 2018
@theodorejb
Copy link

This is still an issue in Insomnia 6.0.2. When I set a query parameter with a value such as %batch or %effort, I get server errors because the % character isn't encoded as %25. Furthermore, if I try to manually encode it in Insomnia by setting the value to %25batch, it still doesn't work because Insomnia replaces %25 with % when performing the request.

It seems like Insomnia's logic is backwards and it's doing the opposite of what it should do (it's removing percent-encoding from query parameter values instead of adding it).

@stale stale bot removed the stale Bot: Stale Issue label Aug 14, 2018
@emelendez89
Copy link

So, how do we bump this up?
Win 10 / v6.0.2 and Still there just as @theodorejb said.

@ganey
Copy link

ganey commented Sep 27, 2018

Also an issue on MacOS v6.0.2

It breaks if the first two characters after the % are 0-9 or A-F

Is the issue somewhere around here? https://github.com/getinsomnia/insomnia/blob/develop/packages/insomnia-url/src/querystring.js#L242

@gschier
Copy link
Contributor

gschier commented Sep 30, 2018

Hmm, ya, already-encoded characters should probably stay encoded. @ganey already found the existing logic to do this but it currently only performs this for a specific set of whitelisted characters.

@6utt3rfly
Copy link

I thought I used to be able to query with a leading %, but it seems to be broken in 6.0.2.
%d% = %25d%25 (good)
%de% = %de%25 (not right)
%25de% = %de%25 (not right either)

  • it seems to work for me in most cases, but maybe there are special characters (like 'de...') that are triggering an escape sequence?
    I'm trying to do a DB query with 'LIKE' through query params, so I'd like the initial % character to be encoded as well

@stale
Copy link

stale bot commented May 3, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Bot: Stale Issue label May 3, 2019
@brolaugh
Copy link
Author

brolaugh commented May 7, 2019

Any update on this?

@stale stale bot removed the stale Bot: Stale Issue label May 7, 2019
@gregsdennis
Copy link

gregsdennis commented Jun 17, 2020

Still running into this issue. Even affects double-encoding:

image

This happens for both of the following URLs

  • https://trello.com/1/batch?urls=%2Forganizations%2F538627f73cbb44d1bfbb58f0%3Ffields%3Dname%252Cprefs (double-encoded comma)
  • https://trello.com/1/batch?urls=%2Forganizations%2F538627f73cbb44d1bfbb58f0%3Ffields%3Dname%2Cprefs (single-encoded comma)

@wdawson wdawson closed this as completed Jun 30, 2021
@Kong Kong locked and limited conversation to collaborators Jun 30, 2021
@Kong Kong unlocked this conversation Jul 1, 2021
@wdawson wdawson reopened this Jul 1, 2021
@wdawson
Copy link
Contributor

wdawson commented Jul 1, 2021

Sorry folks! This was incorrectly tagged as a feature request along with other bugs. I'm going back through and cleaning up, sorry for the inconvenience.

@wdawson wdawson added the B-bug Bug: general classification label Jul 1, 2021
@filfreire filfreire added the S-verified Status: Verified by maintainer label Jul 25, 2022
@anthonyblond
Copy link

I ran into this problem specifically with commas. url?id=1,2,3 becomes url?id=1,2,3, great, can use that to hit endpoint expecting comma separated array (i.e the qs library with comma: true).

Using url?id=1%2C2%2C3 however becomes url?id=1,2,3,looks like now way to encode a comma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-bug Bug: general classification S-verified Status: Verified by maintainer
Projects
None yet
Development

No branches or pull requests

10 participants