Skip to content

Commit 70e12a9

Browse files
committed
- code-gen: ODSP path encoding
1 parent f22b9dd commit 70e12a9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/com/microsoft/graph/requests/DriveItemRequestBuilder.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ public DriveItemRequest buildRequest(@Nonnull final java.util.List<? extends com
9393
*/
9494
@Nonnull
9595
public DriveItemRequestBuilder itemWithPath(@Nonnull final String path) {
96-
return new DriveItemRequestBuilder(getRequestUrl() + ":/" + path + ":", getClient(), null);
96+
String value = path;
97+
try {
98+
value = java.net.URLEncoder.encode(path, java.nio.charset.StandardCharsets.UTF_8.toString()).replace("+", "%20");
99+
//ODSP doesn't respect application/x-www-form-urlencoded MIME format and expects spaces with %20
100+
} catch (java.io.UnsupportedEncodingException ex) {
101+
throw new ClientException("unsupported encoding", ex);
102+
}
103+
return new DriveItemRequestBuilder(getRequestUrl() + ":/" + value + ":", getClient(), null);
97104
}
98105

99106

0 commit comments

Comments
 (0)