diff --git a/google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java b/google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java index 601b52c14..014ecbc90 100644 --- a/google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java +++ b/google-http-client/src/main/java/com/google/api/client/util/escape/PercentEscaper.java @@ -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 @@ -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. */ 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 diff --git a/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedContentTest.java b/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedContentTest.java index 42510c279..ff607b333 100644 --- a/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedContentTest.java +++ b/google-http-client/src/test/java/com/google/api/client/http/UrlEncodedContentTest.java @@ -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)