diff options
| author | chrislu <chris.lu@gmail.com> | 2024-07-08 11:10:41 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2024-07-08 11:10:41 -0700 |
| commit | b8121e4b24b5f5f36928541e0ecf3ab5fc292c87 (patch) | |
| tree | e5c619ea697ce969e9d53de23f9002a82aac2261 | |
| parent | f618121e63f6897e88e4c7f6b5df1f6c8f98f105 (diff) | |
| download | seaweedfs-b8121e4b24b5f5f36928541e0ecf3ab5fc292c87.tar.xz seaweedfs-b8121e4b24b5f5f36928541e0ecf3ab5fc292c87.zip | |
simplify
| -rw-r--r-- | weed/s3api/s3api_object_handlers_delete.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/weed/s3api/s3api_object_handlers_delete.go b/weed/s3api/s3api_object_handlers_delete.go index de05081b7..43849bb07 100644 --- a/weed/s3api/s3api_object_handlers_delete.go +++ b/weed/s3api/s3api_object_handlers_delete.go @@ -43,11 +43,8 @@ func (s3a *S3ApiServer) DeleteObjectHandler(w http.ResponseWriter, r *http.Reque } directoriesWithDeletion := make(map[string]int) - lastSeparator := strings.LastIndex(object, "/") - if lastSeparator > 0 { - parentDirectoryPath := fmt.Sprintf("%s/%s%s", s3a.option.BucketsPath, bucket, object[:lastSeparator]) - directoriesWithDeletion[parentDirectoryPath]++ - + if strings.LastIndex(object, "/") > 0 { + directoriesWithDeletion[dir]++ // purge empty folders, only checking folders with deletions for len(directoriesWithDeletion) > 0 { directoriesWithDeletion = s3a.doDeleteEmptyDirectories(client, directoriesWithDeletion) |
