Fix uri encode bug when url path start with '/'.

Original Pull Request #1873
Closes #1870

(cherry picked from commit d88fb037dadc6798641d51876d81ea64c43bf36b)
(cherry picked from commit 796a5ebe34f588efa4ad83932149fc4081e248a4)
This commit is contained in:
Frnandu Martinski 2021-07-17 19:09:35 +02:00 committed by Peter-Josef Meisch
parent 71f5fa23b7
commit 67cab66062
No known key found for this signature in database
GPG Key ID: DE108246970C7708

View File

@ -1319,7 +1319,7 @@ public class RequestConverters {
// encode each part (e.g. index, type and id) separately before merging them into the path
// we prepend "/" to the path part to make this path absolute, otherwise there can be issues with
// paths that start with `-` or contain `:`
URI uri = new URI(null, null, null, -1, '/' + pathPart, null, null);
URI uri = new URI((String)null, "", "/" + pathPart, (String)null, (String)null);
// manually encode any slash that each part may contain
return uri.getRawPath().substring(1).replaceAll("/", "%2F");
} catch (URISyntaxException e) {