backend/rest: correctly close body on out of bounds read

This commit is contained in:
Michael Eischer
2026-06-14 16:38:54 +02:00
parent 5c8c048c1a
commit ae8fdb08fa
+1
View File
@@ -245,6 +245,7 @@ func (b *Backend) openReader(ctx context.Context, h backend.Handle, length int,
}
if feature.Flag.Enabled(feature.BackendErrorRedesign) && length > 0 && resp.ContentLength != int64(length) {
_ = drainAndClose(resp)
return nil, &restError{h, http.StatusRequestedRangeNotSatisfiable, "partial out of bounds read"}
}