File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
google-http-client/src/main/java/com/google/api/client/util/escape Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ public final class CharEscapers {
4444 private static final Escaper URI_QUERY_STRING_ESCAPER =
4545 new PercentEscaper (PercentEscaper .SAFEQUERYSTRINGCHARS_URLENCODER );
4646
47+ private static final Escaper URI_RESERVED_AND_PERCENT_ENCODED_ESCAPER =
48+ new PercentEncodedEscaper (URI_RESERVED_ESCAPER );
49+
4750 /**
4851 * Escapes the string value so it can be safely included in application/x-www-form-urlencoded
4952 * data. This is not appropriate for generic URI escaping. In particular it encodes the space
@@ -184,6 +187,14 @@ public static String escapeUriPathWithoutReserved(String value) {
184187 return URI_RESERVED_ESCAPER .escape (value );
185188 }
186189
190+ /**
191+ * Escapes a URI path but retains all reserved and percent-encoded characters. That is the same as
192+ * {@link #escapeUriPathWithoutReserved(String)} except that it also escapes percent encoded parts.
193+ */
194+ public static String escapeUriPathWithoutReservedAndPercentEncoded (String value ) {
195+ return URI_RESERVED_AND_PERCENT_ENCODED_ESCAPER .escape (value );
196+ }
197+
187198 /**
188199 * Escapes the string value so it can be safely included in URI user info part. For details on
189200 * escaping URIs, see <a href="http://tools.ietf.org/html/rfc3986#section-2.4">RFC 3986 - section
You can’t perform that action at this time.
0 commit comments