Skip to content
New issue

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

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

Already on GitHub? # to your account

Link.fromUri breaks url encoding during normalization #5416

Closed
sbrosinski opened this issue Sep 19, 2023 · 0 comments · Fixed by #5417
Closed

Link.fromUri breaks url encoding during normalization #5416

sbrosinski opened this issue Sep 19, 2023 · 0 comments · Fixed by #5417

Comments

@sbrosinski
Copy link

This happens in Jersey 2.40

URI uri = UriBuilder.fromUri("http://host.com/path%20path/.test.jpg").build();
Link link = Link.fromUri(uri).build();

build() throws an

java.lang.IllegalArgumentException: Illegal character in path at index 20: http://host.com/path path/.test.jpg

	at java.base/java.net.URI.create(URI.java:883)
	at org.glassfish.jersey.uri.UriTemplate.normalize(UriTemplate.java:375)
	at org.glassfish.jersey.message.internal.JerseyLink$Builder.resolveLinkUri(JerseyLink.java:151)
	at org.glassfish.jersey.message.internal.JerseyLink$Builder.build(JerseyLink.java:138)
	at org.glassfish.jersey.message.internal.JerseyLink$Builder.build(JerseyLink.java:50)

Seems like the /. in the url is normalized according to RFC 3986, the string is url decoded but not probably encoded again afterwards.

@jansupol jansupol linked a pull request Sep 20, 2023 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant