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

@ -19,6 +19,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"
"github.com/ncw/swift/v2"
)
@ -156,7 +157,7 @@ func (be *beSwift) openReader(ctx context.Context, h backend.Handle, length int,
return nil, fmt.Errorf("conn.ObjectOpen: %w", err)
}
if length > 0 {
if feature.Flag.Enabled(feature.BackendErrorRedesign) && length > 0 {
// get response length, but don't cause backend calls
cctx, cancel := context.WithCancel(context.Background())
cancel()