Skip to content
Permalink
Browse files

Remote upload: Add direct_url param for redirect

  • Loading branch information
andreimarcu committed Mar 12, 2020
1 parent a0c508c commit 7543c82473b43760a3dca7a7dee81679462e96cc
Showing with 6 additions and 1 deletion.
  1. +6 −1 upload.go
@@ -184,6 +184,7 @@ func uploadRemote(c web.C, w http.ResponseWriter, r *http.Request) {

upReq := UploadRequest{}
grabUrl, _ := url.Parse(r.FormValue("url"))
directURL := r.FormValue("direct_url") == "yes"

resp, err := http.Get(grabUrl.String())
if err != nil {
@@ -215,7 +216,11 @@ func uploadRemote(c web.C, w http.ResponseWriter, r *http.Request) {
return
}

http.Redirect(w, r, Config.sitePath+upload.Filename, 303)
if directURL {
http.Redirect(w, r, Config.sitePath+Config.selifPath+upload.Filename, 303)
} else {
http.Redirect(w, r, Config.sitePath+upload.Filename, 303)
}
}
}

0 comments on commit 7543c82

Please sign in to comment.
You can’t perform that action at this time.