forked from TrueCloudLab/frostfs-s3-gw
[#450] Fix getPutPayloadSize
If X-Amz-Decoded-Content-Length explicitly set use it even if value is 0 Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
03481274f0
commit
346243b159
2 changed files with 69 additions and 9 deletions
|
@ -91,17 +91,13 @@ func (h *handler) getPutPayloadSize(r *http.Request) uint64 {
|
|||
decodeContentSize := r.Header.Get(api.AmzDecodedContentLength)
|
||||
decodedSize, err := strconv.Atoi(decodeContentSize)
|
||||
if err != nil {
|
||||
decodedSize = 0
|
||||
if r.ContentLength >= 0 {
|
||||
return uint64(r.ContentLength)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var size uint64
|
||||
if decodedSize > 0 {
|
||||
size = uint64(decodedSize)
|
||||
} else if r.ContentLength > 0 {
|
||||
size = uint64(r.ContentLength)
|
||||
}
|
||||
|
||||
return size
|
||||
return uint64(decodedSize)
|
||||
}
|
||||
|
||||
func parseRange(s string) (*layer.RangeParams, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue