Update upload.go
This commit is contained in:
parent
654a1f0a84
commit
cb69d98032
|
@ -60,7 +60,8 @@ func uploadPostHandler(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
upReq := UploadRequest{}
|
upReq := UploadRequest{}
|
||||||
uploadHeaderProcess(r, &upReq)
|
uploadHeaderProcess(r, &upReq)
|
||||||
|
|
||||||
contentType := r.Header.Get("X-Forwarded-For")
|
contentType := r.Header.Get("Content-Type")
|
||||||
|
|
||||||
if strings.HasPrefix(contentType, "multipart/form-data") {
|
if strings.HasPrefix(contentType, "multipart/form-data") {
|
||||||
file, headers, err := r.FormFile("file")
|
file, headers, err := r.FormFile("file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -129,7 +130,6 @@ func uploadPutHandler(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
upReq.filename = c.URLParams["name"]
|
upReq.filename = c.URLParams["name"]
|
||||||
upReq.src = http.MaxBytesReader(w, r.Body, Config.maxSize)
|
upReq.src = http.MaxBytesReader(w, r.Body, Config.maxSize)
|
||||||
upReq.srcIp = r.Header.get("X-Forwarded-For")
|
|
||||||
upload, err := processUpload(upReq)
|
upload, err := processUpload(upReq)
|
||||||
|
|
||||||
if strings.EqualFold("application/json", r.Header.Get("Accept")) {
|
if strings.EqualFold("application/json", r.Header.Get("Accept")) {
|
||||||
|
@ -201,7 +201,6 @@ func uploadRemote(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
upReq.accessKey = r.FormValue(accessKeyParamName)
|
upReq.accessKey = r.FormValue(accessKeyParamName)
|
||||||
upReq.randomBarename = r.FormValue("randomize") == "yes"
|
upReq.randomBarename = r.FormValue("randomize") == "yes"
|
||||||
upReq.expiry = parseExpiry(r.FormValue("expiry"))
|
upReq.expiry = parseExpiry(r.FormValue("expiry"))
|
||||||
upReq.srcIp = r.Header.get("X-Forwarded-For")
|
|
||||||
upload, err := processUpload(upReq)
|
upload, err := processUpload(upReq)
|
||||||
|
|
||||||
if strings.EqualFold("application/json", r.Header.Get("Accept")) {
|
if strings.EqualFold("application/json", r.Header.Get("Accept")) {
|
||||||
|
@ -234,7 +233,7 @@ func uploadHeaderProcess(r *http.Request, upReq *UploadRequest) {
|
||||||
|
|
||||||
upReq.deleteKey = r.Header.Get("Linx-Delete-Key")
|
upReq.deleteKey = r.Header.Get("Linx-Delete-Key")
|
||||||
upReq.accessKey = r.Header.Get(accessKeyHeaderName)
|
upReq.accessKey = r.Header.Get(accessKeyHeaderName)
|
||||||
|
upReq.srcIp = r.Header.get("X-Forwarded-For")
|
||||||
// Get seconds until expiry. Non-integer responses never expire.
|
// Get seconds until expiry. Non-integer responses never expire.
|
||||||
expStr := r.Header.Get("Linx-Expiry")
|
expStr := r.Header.Get("Linx-Expiry")
|
||||||
upReq.expiry = parseExpiry(expStr)
|
upReq.expiry = parseExpiry(expStr)
|
||||||
|
|
Loading…
Reference in New Issue