spring-hateoas icon indicating copy to clipboard operation
spring-hateoas copied to clipboard

559: fix multiple encodings of params

Open Climax85 opened this issue 7 years ago • 5 comments
trafficstars

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.

Climax85 avatar Sep 17 '18 05:09 Climax85

@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 avatar Sep 17 '18 05:09 pivotal-issuemaster

@Climax85 Thank you for signing the Contributor License Agreement!

pivotal-issuemaster avatar Sep 17 '18 05:09 pivotal-issuemaster

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.

gregturn avatar Sep 17 '18 23:09 gregturn

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

jeffreycrump avatar Apr 10 '19 18:04 jeffreycrump

@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:

  • Migration to WebMvcLinkBuilder
  • Deprecation of ControllerLinkBuilder
  • Introduction of WebFluxLinkBuilder
  • #593

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.

gregturn avatar Feb 12 '20 14:02 gregturn