filer: return not found 404 status if not found

fix https://github.com/chrislusf/seaweedfs/issues/1160
This commit is contained in:
Chris Lu 2019-12-18 21:04:40 -08:00
parent ef3ae3cd41
commit 36ddca9d1f

View file

@ -290,7 +290,11 @@ func (fs *FilerServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
err := fs.filer.DeleteEntryMetaAndData(context.Background(), filer2.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError, !skipChunkDeletion)
if err != nil {
glog.V(1).Infoln("deleting", r.URL.Path, ":", err.Error())
writeJsonError(w, r, http.StatusInternalServerError, err)
httpStatus := http.StatusInternalServerError
if err == filer2.ErrNotFound {
httpStatus = http.StatusNotFound
}
writeJsonError(w, r, httpStatus, err)
return
}