mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(objectnode): S3 Folder not recursively deleted
Signed-off-by: FourSpaces <cheng1483x@gmail.com>
This commit is contained in:
parent
e8adeff5fa
commit
9cc87735fe
@ -24,6 +24,7 @@ import (
|
||||
"hash"
|
||||
"io"
|
||||
"os"
|
||||
os_path "path"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
@ -941,6 +942,20 @@ func (v *Volume) DeletePath(path string) (err error) {
|
||||
if err = v.mw.Evict(ino, path); err != nil {
|
||||
log.LogWarnf("DeletePath Evict: path(%v) inode(%v)", path, ino)
|
||||
}
|
||||
|
||||
// Recursive deletion of empty directory
|
||||
if os_path.Dir(path) == "." {
|
||||
return
|
||||
} else {
|
||||
log.LogInfof("os_path.Dir(path): (%v)", os_path.Dir(path))
|
||||
|
||||
if err = v.DeletePath(fmt.Sprintf("%s/", os_path.Dir(path))); err != nil {
|
||||
log.LogErrorf("Recursive DeletePath: delete path fail: path(%v) err(%v)", path, err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
err = nil
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user