java: resolve parent directory if started with seaweedfs://

This commit is contained in:
Chris Lu
2021-02-04 21:41:19 -08:00
parent 42e5ef4b01
commit 8c3177d835
2 changed files with 30 additions and 0 deletions

View File

@@ -84,6 +84,11 @@ public class SeaweedOutputStream extends OutputStream {
}
public static String getParentDirectory(String path) {
int protoIndex = path.indexOf("://");
if (protoIndex >= 0) {
int pathStart = path.indexOf("/", protoIndex+3);
path = path.substring(pathStart);
}
if (path.equals("/")) {
return path;
}