Skip to content

Commit

Permalink
Revert "handler: Avoid calling WriteChunk if no data is available (#746
Browse files Browse the repository at this point in the history
…)"

This reverts commit b5cbafd.

See #798
  • Loading branch information
Acconut committed Sep 9, 2022
1 parent 58c2b65 commit f898cd2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/handler/unrouted_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,6 @@ func (handler *UnroutedHandler) PatchFile(w http.ResponseWriter, r *http.Request

info.Size = uploadLength
info.SizeIsDeferred = false

}

if err := handler.writeChunk(ctx, upload, info, w, r); err != nil {
Expand Down Expand Up @@ -624,7 +623,7 @@ func (handler *UnroutedHandler) writeChunk(ctx context.Context, upload Upload, i
var err error
// Prevent a nil pointer dereference when accessing the body which may not be
// 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
reader := newBodyReader(io.LimitReader(r.Body, maxSize))

Expand Down

0 comments on commit f898cd2

Please sign in to comment.