HDDS-766. Ozone shell create volume fails if volume name does not have a leading slash. Contributed by chencan.

This commit is contained in:
Márton Elek 2018-11-22 15:38:21 +01:00 committed by kube-backup
parent 1aad99a718
commit 96c104d365
2 changed files with 8 additions and 1 deletions

View File

@ -179,6 +179,12 @@ private static URI stringToUri(String pathString) {
// but any occurrence of them will be quoted by the URI ctor.
String path = pathString.substring(start, pathString.length());
// add leading slash to the path, if it does not exist
int firstSlash = path.indexOf('/');
if(firstSlash != 0) {
path = "/" + path;
}
if (authority == null || authority.equals("")) {
authority = EMPTY_HOST;
}

View File

@ -45,7 +45,8 @@ public static Collection<Object[]> data() {
{"http://localhost:9878/"},
{"http://localhost/"},
{"http:///"},
{"/"}
{"/"},
{""}
});
}