Skip to content

fix: encode plus sign in url with %2B #2094

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

Merged
merged 1 commit into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class PercentEscaper extends UnicodeEscaper {
* specified in RFC 3986. Note that some of these characters do need to be escaped when used in
* other parts of the URI.
*/
public static final String SAFEPATHCHARS_URLENCODER = "-_.!~*'()@:$&,;=+";
public static final String SAFEPATHCHARS_URLENCODER = "-_.!~*'()@:$&,;=";

/**
* A string of characters that do not need to be encoded when used in URI Templates reserved
Expand All @@ -72,7 +72,7 @@ public class PercentEscaper extends UnicodeEscaper {
* href="https://www.rfc-editor.org/rfc/rfc6570#section-3.2.3">RFC 6570 - section 3.2.3</a>.
*/
public static final String SAFE_PLUS_RESERVED_CHARS_URLENCODER =
SAFEPATHCHARS_URLENCODER + "/?#[]";
SAFEPATHCHARS_URLENCODER + "+/?#[]";

/**
* A string of characters that do not need to be encoded when used in URI user info part, as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testWriteTo() throws IOException {
subtestWriteTo(
"multi=a&multi=b&multi=c", ArrayMap.of("multi", new String[] {"a", "b", "c"}), true);
subtestWriteTo("username=un&password=password123;%7B%7D", params, true);
subtestWriteTo("additionkey=add+tion", ArrayMap.of("additionkey", "add+tion"), true);
subtestWriteTo("additionkey=add%2Btion", ArrayMap.of("additionkey", "add+tion"), true);
}

private void subtestWriteTo(String expected, Object data, boolean useEscapeUriPathEncoding)
Expand Down