Revert "handler: Avoid calling WriteChunk if no data is available (#746)"
This reverts commit b5cbafdbd5
.
See https://github.com/tus/tusd/issues/798
This commit is contained in:
parent
58c2b65e43
commit
f898cd2b25
|
@ -576,7 +576,6 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request
|
||||||
|
|
||||||
info.Size = uploadLength
|
info.Size = uploadLength
|
||||||
info.SizeIsDeferred = false
|
info.SizeIsDeferred = false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := handler.writeChunk(ctx, upload, info, w, r); err != nil {
|
if err := handler.writeChunk(ctx, upload, info, w, r); err != nil {
|
||||||
|
@ -624,7 +623,7 @@ func (handler *UnroutedHandler) writeChunk(ctx context.Context, upload Upload, i
|
||||||
var err error
|
var err error
|
||||||
// Prevent a nil pointer dereference when accessing the body which may not be
|
// Prevent a nil pointer dereference when accessing the body which may not be
|
||||||
// available in the case of a malicious request.
|
// available in the case of a malicious request.
|
||||||
if r.Body != nil && maxSize > 0 {
|
if r.Body != nil {
|
||||||
// Limit the data read from the request's body to the allowed maximum
|
// Limit the data read from the request's body to the allowed maximum
|
||||||
reader := newBodyReader(io.LimitReader(r.Body, maxSize))
|
reader := newBodyReader(io.LimitReader(r.Body, maxSize))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue