"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
s3: validate CopyCutoff size before copy
hoyhoa24aeba49555
diff --git a/backend/s3/s3.go b/backend/s3/s3.goindex 63f1f46ba..2b0b0ff17 100644--- a/backend/s3/s3.go+++ b/backend/s3/s3.go@@ -3022,6 +3022,14 @@ func (f *Fs) setUploadChunkSize(cs fs.SizeSuffix) (old fs.SizeSuffix, err error)return}+func checkCopyCutoff(cs fs.SizeSuffix) error {+ minCopySize := fs.SizeSuffixBase+ if cs < minCopySize {+ return fmt.Errorf("value is too small (%v is less than %v)", cs, minCopySize)+ }+ return nil+}+func checkUploadCutoff(cs fs.SizeSuffix) error {if cs > maxUploadCutoff {return fmt.Errorf("%s is greater than %s", cs, maxUploadCutoff)@@ -3322,6 +3330,10 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, eif err != nil {return nil, fmt.Errorf("s3: upload cutoff: %w", err)}+ err = checkCopyCutoff(opt.CopyCutoff)+ if err != nil {+ return nil, fmt.Errorf("s3: --s3-copy-cutoff: %w", err)+ }if opt.Versions && opt.VersionAt.IsSet() {return nil, errors.New("s3: can't use --s3-versions and --s3-version-at at the same time")}