diff options
| author | limd <limd@sugon.com> | 2020-09-23 13:15:06 +0800 |
|---|---|---|
| committer | limd <limd@sugon.com> | 2020-09-23 13:15:06 +0800 |
| commit | 1892677b22188cc2f5c4a495fd727fc9ed75b6b5 (patch) | |
| tree | bcf4b631d1485624ae0554ba54d2387ca6197271 | |
| parent | 85570f27a0baf1fb7327d047b5b826eda34e652f (diff) | |
| download | seaweedfs-1892677b22188cc2f5c4a495fd727fc9ed75b6b5.tar.xz seaweedfs-1892677b22188cc2f5c4a495fd727fc9ed75b6b5.zip | |
fixed the problem of empty directory when S3 deleted the directory
| -rw-r--r-- | weed/s3api/s3api_object_handlers.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index cb85aa9fe..994726565 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -183,6 +183,11 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *h s3a.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { for _, object := range deleteObjects.Objects { + response, _ := s3a.listFilerEntries(bucket, object.ObjectName, 1, "", "/") + if len(response.Contents) != 0 && strings.HasSuffix(object.ObjectName, "/") { + continue + } + lastSeparator := strings.LastIndex(object.ObjectName, "/") parentDirectoryPath, entryName, isDeleteData, isRecursive := "/", object.ObjectName, true, true if lastSeparator > 0 && lastSeparator+1 < len(object.ObjectName) { |
