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

Incorrect URL encoded coordinates in REST response #9

Open
missingdays opened this issue Dec 9, 2019 · 2 comments
Open

Incorrect URL encoded coordinates in REST response #9

missingdays opened this issue Dec 9, 2019 · 2 comments

Comments

@missingdays
Copy link

Hi!
I've noticed that requesting coordinates containing "+" symbol in version, e.g. pkg:maven/org.antlr/antlr4@4.+ results in incorrectly encoded coordinates in response - "coordinates": "pkg:maven/org.antlr/antlr4@4.%20. This breaks matching request and response by coordinates.

@voronaam
Copy link

According to the spec 1 "a purl is a URL" and conforms to the RFC.

As such, you would need to encode + as %2B - much like any time you would want to do that with an URL.

And "pkg:maven/org.antlr/antlr4@4.%2B" comes through properly, as far as I could tell.

@missingdays
Copy link
Author

missingdays commented Jan 20, 2020

According to URL specification, + sign is not a special character and can be used without encoding it. See https://tools.ietf.org/html/rfc1738, specifically part 5, BNF for specific URL schemes.

The problem in question is that the + sign is that it's encoded as %20 which is an encoding for a sign (a space) and not for a + sign. This error probably comes from using URLEncoder.encode, which is not URL specification compliant, see https://bugs.openjdk.java.net/browse/JDK-8179507

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

No branches or pull requests

2 participants