aboutsummaryrefslogtreecommitdiff
path: root/weed/server
diff options
context:
space:
mode:
authorLei Liu <lei01.liu@horizon.ai>2019-09-29 14:17:37 +0800
committerLei Liu <lei01.liu@horizon.ai>2019-09-29 14:23:39 +0800
commit3cc084269c47d72df463760445920b45819e9feb (patch)
tree90c850277dd5ab530aae9baaf644d99bc779244c /weed/server
parent972e881d485a1a5b4587f47ef55bbbf5182837f7 (diff)
downloadseaweedfs-3cc084269c47d72df463760445920b45819e9feb.tar.xz
seaweedfs-3cc084269c47d72df463760445920b45819e9feb.zip
master api: return http 404 when volumeId not exist
Signed-off-by: Lei Liu <lei01.liu@horizon.ai>
Diffstat (limited to 'weed/server')
-rw-r--r--weed/server/filer_server_handlers_write.go2
-rw-r--r--weed/server/master_server_handlers.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go
index b419c51af..5d95a5d7e 100644
--- a/weed/server/filer_server_handlers_write.go
+++ b/weed/server/filer_server_handlers_write.go
@@ -275,7 +275,7 @@ func (fs *FilerServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
isRecursive := r.FormValue("recursive") == "true"
ignoreRecursiveError := r.FormValue("ignoreRecursiveError") == "true"
- err := fs.filer.DeleteEntryMetaAndData(context.Background(), filer2.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError,true)
+ err := fs.filer.DeleteEntryMetaAndData(context.Background(), filer2.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError, true)
if err != nil {
glog.V(1).Infoln("deleting", r.URL.Path, ":", err.Error())
writeJsonError(w, r, http.StatusInternalServerError, err)
diff --git a/weed/server/master_server_handlers.go b/weed/server/master_server_handlers.go
index 93f983375..728c32076 100644
--- a/weed/server/master_server_handlers.go
+++ b/weed/server/master_server_handlers.go
@@ -48,7 +48,7 @@ func (ms *MasterServer) dirLookupHandler(w http.ResponseWriter, r *http.Request)
collection := r.FormValue("collection") //optional, but can be faster if too many collections
location := ms.findVolumeLocation(collection, vid)
httpStatus := http.StatusOK
- if location.Error != "" {
+ if location.Error != "" || location.Locations == nil {
httpStatus = http.StatusNotFound
} else {
forRead := r.FormValue("read")
@@ -60,7 +60,7 @@ func (ms *MasterServer) dirLookupHandler(w http.ResponseWriter, r *http.Request)
// findVolumeLocation finds the volume location from master topo if it is leader,
// or from master client if not leader
-func (ms *MasterServer) findVolumeLocation(collection string, vid string) operation.LookupResult {
+func (ms *MasterServer) findVolumeLocation(collection, vid string) operation.LookupResult {
var locations []operation.Location
var err error
if ms.Topo.IsLeader() {