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

Wrong URL Encode #435

Open
Farhan25 opened this issue Dec 29, 2020 · 5 comments
Open

Wrong URL Encode #435

Farhan25 opened this issue Dec 29, 2020 · 5 comments
Labels

Comments

@Farhan25
Copy link

Describe the bug
There seems to be a bug in URL encode for PHP generator (cURL, HTTP_Request2, pecl_http) and many others languages

To Reproduce
fix the URL encode

Expected code snippet and corresponding request
resource_id=sc-domain%253Aexample.com is wrong encoing
the right one is resource_id=sc-domain%3Aexample.com

Screenshots
image

Additional context
the two URLs are different so the whole request would give two separate results.

Version of postman-code-generators/Postman app:
I have the latest version for windows v7.36.1

@ShauryaAg
Copy link

The issue is that it is not replacing '%' sign correctly when it is passed as params in the Request body.

To Reproduce:

Pass a parameter with '%' as value to any key

The error:

Error is at line 111 of postman-code-generators/codegens/php-curl/lib/php-curl.js/

The encodeURI() function parses '%' as '%25'
image

I would like to work on this issue. @abhijitkane

@Farhan25
Copy link
Author

Farhan25 commented Jan 1, 2021

Well I know what's the problem is, there is double encoding in there which cause the % to be encoded in the second time.
I just mentioned it to be solved in the next update.
Thanks for your work and if It's necessary I can help you guys :)

@webholik
Copy link
Collaborator

webholik commented Jan 3, 2021

@Farhan25 Can you share the exact url that you are passing to postman? The one without any encoding applied.

@ShauryaAg
Copy link

@webholik In that case, one cannot just copy any URL (say from chrome's URL bar), and paste it in Postman's URL Field.

I have made a PR #437 that fixes this issue. Can you please review it?
Thanks

@Farhan25
Copy link
Author

Farhan25 commented Jan 4, 2021

@ShauryaAg of course, here is a similar one:
https://search.google.com/search-console/links?resource_id=sc-domain%3Aexample.com

the problem is encoding the percentage symbol in the second time (% is encoded as %25).

: => %3A
%3A => %253A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants