Remote upload: Add direct_url param for redirect
This commit is contained in:
parent
a0c508c422
commit
7543c82473
|
@ -184,6 +184,7 @@ func uploadRemote(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
upReq := UploadRequest{}
|
upReq := UploadRequest{}
|
||||||
grabUrl, _ := url.Parse(r.FormValue("url"))
|
grabUrl, _ := url.Parse(r.FormValue("url"))
|
||||||
|
directURL := r.FormValue("direct_url") == "yes"
|
||||||
|
|
||||||
resp, err := http.Get(grabUrl.String())
|
resp, err := http.Get(grabUrl.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -215,8 +216,12 @@ func uploadRemote(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if directURL {
|
||||||
|
http.Redirect(w, r, Config.sitePath+Config.selifPath+upload.Filename, 303)
|
||||||
|
} else {
|
||||||
http.Redirect(w, r, Config.sitePath+upload.Filename, 303)
|
http.Redirect(w, r, Config.sitePath+upload.Filename, 303)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func uploadHeaderProcess(r *http.Request, upReq *UploadRequest) {
|
func uploadHeaderProcess(r *http.Request, upReq *UploadRequest) {
|
||||||
|
|
Loading…
Reference in New Issue