aboutsummaryrefslogtreecommitdiff
path: root/weed/server/master_server_handlers.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2019-09-28 23:34:05 -0700
committerGitHub <noreply@github.com>2019-09-28 23:34:05 -0700
commit1bb4449e5e14d15af274a27ad4b18302ca91675b (patch)
tree90c850277dd5ab530aae9baaf644d99bc779244c /weed/server/master_server_handlers.go
parent972e881d485a1a5b4587f47ef55bbbf5182837f7 (diff)
parent3cc084269c47d72df463760445920b45819e9feb (diff)
downloadseaweedfs-1bb4449e5e14d15af274a27ad4b18302ca91675b.tar.xz
seaweedfs-1bb4449e5e14d15af274a27ad4b18302ca91675b.zip
Merge pull request #1076 from iliul/fix-lookup-statuscode
master api: return http 404 when volumeId not exist
Diffstat (limited to 'weed/server/master_server_handlers.go')
-rw-r--r--weed/server/master_server_handlers.go4
1 files changed, 2 insertions, 2 deletions
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() {