SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
handle "/" in exist
Jérôme Barotin89b2ef8d0558
diff --git a/other/java/client/src/main/java/seaweedfs/client/FilerClient.java b/other/java/client/src/main/java/seaweedfs/client/FilerClient.javaindex de03efbb41..0a83562585 100644--- a/other/java/client/src/main/java/seaweedfs/client/FilerClient.java+++ b/other/java/client/src/main/java/seaweedfs/client/FilerClient.java@@ -128,7 +128,14 @@ public class FilerClient extends FilerGrpcClient {public boolean exists(String path){File pathFile = new File(path);- return lookupEntry(pathFile.getParent(), pathFile.getName()) != null;+ String parent = pathFile.getParent();+ String entryName = pathFile.getName();+ if(parent == null) {+ parent = path;+ entryName ="";+ }+ return lookupEntry(parent, entryName) != null;+}public boolean rm(String path, boolean isRecursive, boolean ignoreRecusiveError) {diff --git a/other/java/client/src/test/java/seaweedfs/client/SeaweedFilerTest.java b/other/java/client/src/test/java/seaweedfs/client/SeaweedFilerTest.javaindex c45ce7a9dc..f9a2c3f769 100644--- a/other/java/client/src/test/java/seaweedfs/client/SeaweedFilerTest.java+++ b/other/java/client/src/test/java/seaweedfs/client/SeaweedFilerTest.java@@ -25,5 +25,8 @@ public class SeaweedFilerTest {if(filerClient.exists("/new_folder/new_empty_file")){System.out.println("/new_folder/new_empty_file should not exists");}+ if(!filerClient.exists("/")){+ System.out.println("/ should exists");+ }}}