Return upload length error if it's too small or too large
This commit is contained in:
parent
d545b6518b
commit
22fdd3935b
|
@ -461,8 +461,8 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
|
|||
|
||||
if handler.composer.UsesLengthDeferrer && info.SizeIsDeferred && r.Header.Get("Upload-Length") != "" {
|
||||
uploadLength, err := strconv.ParseInt(r.Header.Get("Upload-Length"), 10, 64)
|
||||
if err != nil || uploadLength < 0 {
|
||||
handler.sendError(w, r, ErrInvalidOffset)
|
||||
if err != nil || uploadLength < 0 || uploadLength < info.Offset || uploadLength > handler.config.MaxSize {
|
||||
handler.sendError(w, r, ErrInvalidUploadLength)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue