aboutsummaryrefslogtreecommitdiff
path: root/weed/server
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-06-22 10:01:00 -0700
committerChris Lu <chris.lu@gmail.com>2020-06-22 10:01:00 -0700
commita4e3cffe0a452ad12b5aa9e3f57113a0fa4ba7ce (patch)
treea718997d7745e6fce805b1461e3003176440c2b2 /weed/server
parenta73fd7682a380e077a71e17220fca800ac98bcb5 (diff)
downloadseaweedfs-a4e3cffe0a452ad12b5aa9e3f57113a0fa4ba7ce.tar.xz
seaweedfs-a4e3cffe0a452ad12b5aa9e3f57113a0fa4ba7ce.zip
S3: DeleteObject API also support deleting a folder recursively
Diffstat (limited to 'weed/server')
-rw-r--r--weed/server/filer_server_handlers_write.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go
index 74a558e22..5fa628708 100644
--- a/weed/server/filer_server_handlers_write.go
+++ b/weed/server/filer_server_handlers_write.go
@@ -316,9 +316,14 @@ func (fs *FilerServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
ignoreRecursiveError := r.FormValue("ignoreRecursiveError") == "true"
skipChunkDeletion := r.FormValue("skipChunkDeletion") == "true"
- err := fs.filer.DeleteEntryMetaAndData(context.Background(), util.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError, !skipChunkDeletion)
+ objectPath := r.URL.Path
+ if len(r.URL.Path) > 1 && strings.HasSuffix(objectPath, "/") {
+ objectPath = objectPath[0 : len(objectPath)-1]
+ }
+
+ err := fs.filer.DeleteEntryMetaAndData(context.Background(), util.FullPath(objectPath), isRecursive, ignoreRecursiveError, !skipChunkDeletion)
if err != nil {
- glog.V(1).Infoln("deleting", r.URL.Path, ":", err.Error())
+ glog.V(1).Infoln("deleting", objectPath, ":", err.Error())
httpStatus := http.StatusInternalServerError
if err == filer_pb.ErrNotFound {
httpStatus = http.StatusNotFound