-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 spaces encoding inside DefaultUriBuilder #11439
base: 4.8.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -415,6 +415,7 @@ private String expandOrEncode(String value, Map<String, ? super Object> values) | |
} | ||
|
||
private String encode(String userInfo) { | ||
return URLEncoder.encode(userInfo, StandardCharsets.UTF_8); | ||
return URLEncoder.encode(userInfo, StandardCharsets.UTF_8) | ||
.replaceAll("\\+", "%20"); // to match RFC3986 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can't just change the framework's behavior. I think the most reasonable solution is to add a setting - how to encode a space. Then you leave backward compatibility and whoever needs it will enable RFC support mode There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree with you Im gonna add it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not a good look for the framework to be handling this incorrectly when competing frameworks get it right. I'd argue it should be changed to the correct behavior, with an option to revert to the prior (incorrect) encoding behavior if needed. The Apache URIBuilder I mentioned in my earlier comment gets this right, defaulting to the correct encoding of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yawkat need your final decision There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed we can't change it this way, at least not without a config option. |
||
} | ||
} |
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.
I think this is unnecessary
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.
I missed it after debug, thanks ;)