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

Fix link parsing for non-trivial cases

Open viliam-durina opened this issue 1 year ago • 0 comments

The previous implementation used naive parsing suffering from many issues, especially when special characters were part of values. It also didn't escape the special characters when serializing a link to string.

I marked the Link.valueOf method as deprecated because it doesn't correctly parse multiple links, nor does it handle multiple values for the rel param. One should use Links.parse. There are no other incompatible API changes.

I had to change one current test: we no longer ignore missing final > after the URL - such link is invalid anyway because it didn't have the rel parameter.

Fixes #2099

Tests have 100% coverage of the new code, except for one line that cannot currently happen, but is there for robustness.

viliam-durina avatar Mar 20 '24 12:03 viliam-durina