Browse Source

also delete parent folder if empty

fix https://github.com/seaweedfs/seaweedfs/issues/5567
pull/5578/head
chrislu 8 months ago
parent
commit
1917f70f78
  1. 2
      weed/s3api/s3api_object_handlers_delete.go

2
weed/s3api/s3api_object_handlers_delete.go

@ -44,7 +44,7 @@ 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", s3a.option.BucketsPath, bucket)
parentDirectoryPath := fmt.Sprintf("%s/%s%s", s3a.option.BucketsPath, bucket, object[:lastSeparator])
directoriesWithDeletion[parentDirectoryPath]++
// purge empty folders, only checking folders with deletions

Loading…
Cancel
Save