Skip to content

Commit 1f8aca7

Browse files
authored
fix: encode + sign in url with %2B (googleapis#2094)
1 parent f2e1454 commit 1f8aca7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class PercentEscaper extends UnicodeEscaper {
6161
* specified in RFC 3986. Note that some of these characters do need to be escaped when used in
6262
* other parts of the URI.
6363
*/
64-
public static final String SAFEPATHCHARS_URLENCODER = "-_.!~*'()@:$&,;=+";
64+
public static final String SAFEPATHCHARS_URLENCODER = "-_.!~*'()@:$&,;=";
6565

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

7777
/**
7878
* A string of characters that do not need to be encoded when used in URI user info part, as

google-http-client/src/test/java/com/google/api/client/http/UrlEncodedContentTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void testWriteTo() throws IOException {
6262
subtestWriteTo(
6363
"multi=a&multi=b&multi=c", ArrayMap.of("multi", new String[] {"a", "b", "c"}), true);
6464
subtestWriteTo("username=un&password=password123;%7B%7D", params, true);
65-
subtestWriteTo("additionkey=add+tion", ArrayMap.of("additionkey", "add+tion"), true);
65+
subtestWriteTo("additionkey=add%2Btion", ArrayMap.of("additionkey", "add+tion"), true);
6666
}
6767

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

0 commit comments

Comments
 (0)