mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
master: redirect handler accept collection parameter
This commit is contained in:
parent
4734efa9a1
commit
db1ac7b3eb
|
@ -121,7 +121,8 @@ func (ms *MasterServer) redirectHandler(w http.ResponseWriter, r *http.Request)
|
||||||
debug("parsing error:", err, r.URL.Path)
|
debug("parsing error:", err, r.URL.Path)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
machines := ms.Topo.Lookup("", volumeId)
|
collection := r.FormValue("collection")
|
||||||
|
machines := ms.Topo.Lookup(collection, volumeId)
|
||||||
if machines != nil && len(machines) > 0 {
|
if machines != nil && len(machines) > 0 {
|
||||||
var url string
|
var url string
|
||||||
if r.URL.RawQuery != "" {
|
if r.URL.RawQuery != "" {
|
||||||
|
@ -131,7 +132,7 @@ func (ms *MasterServer) redirectHandler(w http.ResponseWriter, r *http.Request)
|
||||||
}
|
}
|
||||||
http.Redirect(w, r, url, http.StatusMovedPermanently)
|
http.Redirect(w, r, url, http.StatusMovedPermanently)
|
||||||
} else {
|
} else {
|
||||||
writeJsonError(w, r, http.StatusNotFound, fmt.Errorf("volume id %d not found", volumeId))
|
writeJsonError(w, r, http.StatusNotFound, fmt.Errorf("volume id %d or collection %s not found", volumeId, collection))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue