mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-18 12:08:32 +02:00
S3: DeleteObject API also support deleting a folder recursively
This commit is contained in:
1 parent
a73fd7682a
commit
a4e3cffe0a
2 files changed
+8
-3
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user