mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
volume: redirection follow public url
fix https://github.com/chrislusf/seaweedfs/issues/1089
This commit is contained in:
parent
c0776aa40f
commit
c358f96aaa
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"mime"
|
"mime"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
|
@ -66,7 +67,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
|
||||||
glog.V(2).Infoln("volume", volumeId, "found on", lookupResult, "error", err)
|
glog.V(2).Infoln("volume", volumeId, "found on", lookupResult, "error", err)
|
||||||
if err == nil && len(lookupResult.Locations) > 0 {
|
if err == nil && len(lookupResult.Locations) > 0 {
|
||||||
u, _ := url.Parse(util.NormalizeUrl(lookupResult.Locations[0].PublicUrl))
|
u, _ := url.Parse(util.NormalizeUrl(lookupResult.Locations[0].PublicUrl))
|
||||||
u.Path = r.URL.Path
|
u.Path = fmt.Sprintf("%s/%s,%s", u.Path, vid, fid)
|
||||||
arg := url.Values{}
|
arg := url.Values{}
|
||||||
if c := r.FormValue("collection"); c != "" {
|
if c := r.FormValue("collection"); c != "" {
|
||||||
arg.Set("collection", c)
|
arg.Set("collection", c)
|
||||||
|
|
Loading…
Reference in a new issue