aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/filer_util.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-03-07 16:51:46 -0800
committerChris Lu <chris.lu@gmail.com>2020-03-07 16:51:46 -0800
commit8645283a7b8a50485390267be9f83b83707f6161 (patch)
tree9e3e3f212d918e9fa7b0ac90b6ac9d9d687d0b56 /weed/s3api/filer_util.go
parent936e7cdbfb02e719058fa341772f2f8afee2a9f1 (diff)
downloadseaweedfs-8645283a7b8a50485390267be9f83b83707f6161.tar.xz
seaweedfs-8645283a7b8a50485390267be9f83b83707f6161.zip
fuse mount: avoid lookup nil entry
fix https://github.com/chrislusf/seaweedfs/issues/1221
Diffstat (limited to 'weed/s3api/filer_util.go')
-rw-r--r--weed/s3api/filer_util.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/s3api/filer_util.go b/weed/s3api/filer_util.go
index b94b30a87..d43ca8e5d 100644
--- a/weed/s3api/filer_util.go
+++ b/weed/s3api/filer_util.go
@@ -8,6 +8,7 @@ import (
"strings"
"time"
+ "github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
)
@@ -202,15 +203,15 @@ func (s3a *S3ApiServer) exists(parentDirectoryPath string, entryName string, isD
}
glog.V(4).Infof("exists entry %v/%v: %v", parentDirectoryPath, entryName, request)
- resp, err := client.LookupDirectoryEntry(context.Background(), request)
+ resp, err := filer_pb.LookupEntry(client, request)
if err != nil {
+ if err == filer2.ErrNotFound {
+ exists = false
+ return nil
+ }
glog.V(0).Infof("exists entry %v: %v", request, err)
return fmt.Errorf("exists entry %s/%s: %v", parentDirectoryPath, entryName, err)
}
- if resp.Entry == nil {
- exists = false
- return nil
- }
exists = resp.Entry.IsDirectory == isDirectory