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

Having issue when using URI components to escape URLs in 1.15.4 #1902

Closed
linweiyuan opened this issue Feb 22, 2023 · 2 comments
Closed

Having issue when using URI components to escape URLs in 1.15.4 #1902

linweiyuan opened this issue Feb 22, 2023 · 2 comments
Assignees
Labels
bug Confirmed bug that we should fix fixed
Milestone

Comments

@linweiyuan
Copy link

I have an auth api using jsoup to call, when I use 1.15.3, works fine, but yesterday I upgraded it to 1.15.4, a 400 bad request was returned. The url has an encoded space (%20) like https://auth0.xxx.com/authorize?client_id=xxx&scope=openid%20email%20profile, in 1.15.4 will be encoded to https://auth0.xxx.com/authorize?client_id=xxx&scope=openid%2520email%2520profile, the '%' is also encoded.

I debug and found this commit: 45ed002#diff-50cf357d24b529d8ec8ffd200e666d29cb8286c71733da1a27c9b32d1204d676

It is easy to reproduce:

Connection connect = Jsoup.connect("https://the-site/a%20b%20c");
System.out.println(connect.request().url());

Can help to have a look? Thanks in advance.

@jhy jhy added this to the 1.16.1 milestone Feb 24, 2023
@jhy jhy added the bug Confirmed bug that we should fix label Feb 24, 2023
@jhy
Copy link
Owner

jhy commented Feb 24, 2023

Ah, nuts!

I thought we had tests for this, but there's only the single direction:

@Test public void encodeUrl() throws MalformedURLException {
URL url1 = new URL("https://test.com/foo bar/[One]?q=white space#frag");
URL url2 = HttpConnection.encodeUrl(url1);
assertEquals("https://test.com/foo%20bar/%5BOne%5D?q=white%20space#frag", url2.toExternalForm());
}

@jhy jhy closed this as completed in a96ebc9 Feb 24, 2023
@jhy jhy self-assigned this Feb 24, 2023
@jhy jhy added the fixed label Feb 24, 2023
@jhy
Copy link
Owner

jhy commented Feb 24, 2023

Fixed -- thanks for the report! And apologies for the regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug that we should fix fixed
Projects
None yet
Development

No branches or pull requests

2 participants