From 0c75f15062c931d457fb52a079ca22fbb4679247 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 12 Jan 2022 23:57:54 -0800 Subject: [PATCH] POSIX: should not delete if a directory is not empty --- weed/filesys/dir.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go index 79981259f..53633b2f1 100644 --- a/weed/filesys/dir.go +++ b/weed/filesys/dir.go @@ -473,11 +473,11 @@ func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error { dirFullPath := dir.FullPath() glog.V(3).Infof("remove directory entry: %v", req) - ignoreRecursiveErr := true // ignore recursion error since the OS should manage it - err := filer_pb.Remove(dir.wfs, dirFullPath, req.Name, true, true, ignoreRecursiveErr, false, []int32{dir.wfs.signature}) + ignoreRecursiveErr := false // ignore recursion error since the OS should manage it + err := filer_pb.Remove(dir.wfs, dirFullPath, req.Name, true, false, ignoreRecursiveErr, false, []int32{dir.wfs.signature}) if err != nil { glog.V(0).Infof("remove %s/%s: %v", dirFullPath, req.Name, err) - if strings.Contains(err.Error(), "non-empty") { + if strings.Contains(err.Error(), filer.MsgFailDelNonEmptyFolder) { return fuse.EEXIST } return fuse.ENOENT