diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 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, e if 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") }