|
|
@ -167,7 +167,7 @@ func extractPostPolicyFormValues(form *multipart.Form) (filePart io.ReadCloser, |
|
|
|
canonicalFormName := http.CanonicalHeaderKey(k) |
|
|
|
canonicalFormName := http.CanonicalHeaderKey(k) |
|
|
|
// Check if value's field exceeds S3 limit
|
|
|
|
// Check if value's field exceeds S3 limit
|
|
|
|
if int64(len(v[0])) > maxFormFieldSize { |
|
|
|
if int64(len(v[0])) > maxFormFieldSize { |
|
|
|
return nil, "", 0, nil, errSizeUnexpected |
|
|
|
return nil, "", 0, nil, traceError(errSizeUnexpected) |
|
|
|
} |
|
|
|
} |
|
|
|
// Set the form value
|
|
|
|
// Set the form value
|
|
|
|
formValues[canonicalFormName] = v[0] |
|
|
|
formValues[canonicalFormName] = v[0] |
|
|
@ -178,7 +178,7 @@ func extractPostPolicyFormValues(form *multipart.Form) (filePart io.ReadCloser, |
|
|
|
canonicalFormName := http.CanonicalHeaderKey(k) |
|
|
|
canonicalFormName := http.CanonicalHeaderKey(k) |
|
|
|
if canonicalFormName == "File" { |
|
|
|
if canonicalFormName == "File" { |
|
|
|
if len(v) == 0 { |
|
|
|
if len(v) == 0 { |
|
|
|
return nil, "", 0, nil, errInvalidArgument |
|
|
|
return nil, "", 0, nil, traceError(errInvalidArgument) |
|
|
|
} |
|
|
|
} |
|
|
|
// Fetch fileHeader which has the uploaded file information
|
|
|
|
// Fetch fileHeader which has the uploaded file information
|
|
|
|
fileHeader := v[0] |
|
|
|
fileHeader := v[0] |
|
|
@ -186,15 +186,18 @@ func extractPostPolicyFormValues(form *multipart.Form) (filePart io.ReadCloser, |
|
|
|
fileName = fileHeader.Filename |
|
|
|
fileName = fileHeader.Filename |
|
|
|
// Open the uploaded part
|
|
|
|
// Open the uploaded part
|
|
|
|
filePart, err = fileHeader.Open() |
|
|
|
filePart, err = fileHeader.Open() |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return nil, "", 0, nil, traceError(err) |
|
|
|
|
|
|
|
} |
|
|
|
// Compute file size
|
|
|
|
// Compute file size
|
|
|
|
fileSize, err = filePart.(io.Seeker).Seek(0, 2) |
|
|
|
fileSize, err = filePart.(io.Seeker).Seek(0, 2) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, "", 0, nil, err |
|
|
|
return nil, "", 0, nil, traceError(err) |
|
|
|
} |
|
|
|
} |
|
|
|
// Reset Seek to the beginning
|
|
|
|
// Reset Seek to the beginning
|
|
|
|
_, err = filePart.(io.Seeker).Seek(0, 0) |
|
|
|
_, err = filePart.(io.Seeker).Seek(0, 0) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, "", 0, nil, err |
|
|
|
return nil, "", 0, nil, traceError(err) |
|
|
|
} |
|
|
|
} |
|
|
|
// File found and ready for reading
|
|
|
|
// File found and ready for reading
|
|
|
|
break |
|
|
|
break |
|
|
|