mirror of
https://github.com/restic/restic.git
synced 2025-10-09 07:33:53 +00:00
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:
@@ -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"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
@@ -404,7 +405,7 @@ func (be *Backend) openReader(ctx context.Context, h backend.Handle, length int,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if length > 0 {
|
||||
if feature.Flag.Enabled(feature.BackendErrorRedesign) && length > 0 {
|
||||
if info.Size > 0 && info.Size != int64(length) {
|
||||
_ = rd.Close()
|
||||
return nil, minio.ErrorResponse{Code: "InvalidRange", Message: "restic-file-too-short"}
|
||||
|
Reference in New Issue
Block a user