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

559: fix multiple encodings of params #738

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Climax85
Copy link

In order to #559 I got multiple encodings using the ControllerLinkBuilder. I added corresponding tests and fixed the issue. The ControllerLinkBuilder#bindRequestParameters method already encodes the params in the template url. Any further expand of the url will encode the % sign in %25. So no additional encoding should be done.
The Link#expand method is not only used to expand parameters in the template but also to check for missing required parameters.
I added another checkParams method to the UriTemplate class to only check the params but not encoding them.

@pivotal-issuemaster
Copy link

@Climax85 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@Climax85 Thank you for signing the Contributor License Agreement!

Copy link
Member

@odrotbohm odrotbohm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about this one. The test cases don't seem to check for any double encoding in the first place. Their names aren't quite telling what the intend of the tests are actually.

Also, see my comment on checkParams(…). I didn't actually get the intention of the method.

src/main/java/org/springframework/hateoas/UriTemplate.java Outdated Show resolved Hide resolved
@gregturn
Copy link
Contributor

I second @olivergierke 's comments.

I'd start with a battery of tests exposing the issue at hand. In fact, the code you from #559 would be a perfect candidate to put into a unit test that you could then test away at ensuring it acts properly.

@jeffreycrump
Copy link

Any update here? This bug makes ControllerLinkBuilder pretty much useless for non-template URLs.

@gregturn
Copy link
Contributor

@Climax85 @jeffreycrump

Do you have a test case that exposes the problems here? Also, there have been considerable changes to Spring HATEOAS since this ticket was opened including:

Please tell me if the latest version (1.1.0.M3 just came out) solves your problems. If not, can you provide a test case illustrating the issue.

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

Successfully merging this pull request may close these issues.

None yet

5 participants