rest/rclone/s3/sftp/swift: move short file detection behind feature gate

These backends tend to use a large variety of server implementations.
Some of those implementations might prove problematic with the new
checks.
This commit is contained in:
Michael Eischer
2024-05-12 11:55:34 +02:00
parent 6328b7e1f5
commit 394c8ca3ed
4 changed files with 8 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ import (
"github.com/restic/restic/internal/backend/util"
"github.com/restic/restic/internal/debug"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/feature"
)
// make sure the rest backend implements backend.Backend
@@ -245,7 +246,7 @@ func (b *Backend) openReader(ctx context.Context, h backend.Handle, length int,
return nil, &restError{h, resp.StatusCode, resp.Status}
}
if length > 0 && resp.ContentLength != int64(length) {
if feature.Flag.Enabled(feature.BackendErrorRedesign) && length > 0 && resp.ContentLength != int64(length) {
return nil, &restError{h, http.StatusRequestedRangeNotSatisfiable, "partial out of bounds read"}
}