Insomnia: [Bug] URL escaped UTF-8 code units get de-encoded

Created on 8 Jun 2018  路  11Comments  路  Source: Kong/insomnia

  • 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.

accepted

Most helpful comment

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).

All 11 comments

馃憢 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.

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'.

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.

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).

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

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

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.

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

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.

Any update on this?

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)
Was this page helpful?
0 / 5 - 0 ratings