Skip to content

Commit 67cab66

Browse files
Frnandu Martinskisothawo
authored andcommitted
Fix uri encode bug when url path start with '/'.
Original Pull Request #1873 Closes #1870 (cherry picked from commit d88fb03) (cherry picked from commit 796a5eb)
1 parent 71f5fa2 commit 67cab66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/springframework/data/elasticsearch/client/util/RequestConverters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ private static String encodePart(String pathPart) {
13191319
// encode each part (e.g. index, type and id) separately before merging them into the path
13201320
// we prepend "/" to the path part to make this path absolute, otherwise there can be issues with
13211321
// paths that start with `-` or contain `:`
1322-
URI uri = new URI(null, null, null, -1, '/' + pathPart, null, null);
1322+
URI uri = new URI((String)null, "", "/" + pathPart, (String)null, (String)null);
13231323
// manually encode any slash that each part may contain
13241324
return uri.getRawPath().substring(1).replaceAll("/", "%2F");
13251325
} catch (URISyntaxException e) {

0 commit comments

Comments
 (0)