-
Notifications
You must be signed in to change notification settings - Fork 475
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
Fix link parsing for non-trivial cases #2128
base: main
Are you sure you want to change the base?
Fix link parsing for non-trivial cases #2128
Conversation
@odrotbohm Hi, could you have a look at this PR? It fixes a serious issue and has 100% test coverage. |
Given this adds significant complexity, would you mind extracting the actual parsing into a package protected type |
@odrotbohm I'll work on that. I have just one question: are the blank lines part of your standard format? I normally fix format of the code near which I'm working. |
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 spring-projects#2099
a6fcbda
to
65c3de5
Compare
I pushed the requested changes, except:
|
I'll take it from here. |
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 therel
param. One should useLinks.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.