-
Notifications
You must be signed in to change notification settings - Fork 34
fix: duplicate key exception #907
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
Conversation
Signed-off-by: alperozturk <[email protected]>
korelstar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can confirm, that this fixes nextcloud/notes-android#2848. However, I'm not sure, if this could cause problems for other HTTP headers.
|
Hopefully this doesn't break anything elsewhere. FWIW, this PR is what RFC 2616 & 9110 say to do with duplicate headers. https://www.rfc-editor.org/rfc/rfc9110#name-field-lines-and-combined-fi |
|
Hello, However, the code just joins any header values with a ", " separator in between. I don't know whether the app relies on any of these headers (or will do so in the future), but you might rather want to join distinct values only to avoid issues. In my case it was caused by two |
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
| final String value = header.getValue(); | ||
|
|
||
| // Create a unique key for name:value combination | ||
| final String key = name.toLowerCase() + ":" + value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This could fix downstream issues like e.g. nextcloud/notes-android#2531
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This could fix downstream issues like e.g. nextcloud/notes-android#2531
I don't think so. It doesn't actually store the headers with the lowercase key, only uses that for deduplicating them.
For that issue, I did comment on #796 with a likely solution, but I didn't manage to build Notes against my test version to find out.
|
Hey. Thank you for your messages. I’ve updated the PR with tests. Since I wasn’t able to reproduce the issue on my side, could you please test the latest version from here ? As you can see from the tests, I think the expected values appear to be reasonable, but I’d appreciate your confirmation. |
|
I've just tested that build, syncing works correctly again and newly created notes show up without a refresh (nextcloud/notes-android#2850) |
korelstar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Latest updates still fix nextcloud/notes-android#2848. I would be happy to see this released soon :-)
andrewille
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me and works well. :)
Fixes
nextcloud/notes-android#2848