From ffeefe8a56ca09ba805816e3a036775c11eb30aa Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 23 Dec 2022 16:52:19 +0000 Subject: [PATCH] crypt: obey --ignore-checksum Before this change the crypt backend would calculate and check upload checksums regardless of the setting of --ignore-checksum. --- backend/crypt/crypt.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/crypt/crypt.go b/backend/crypt/crypt.go index 1aece2753..b1c8111d0 100644 --- a/backend/crypt/crypt.go +++ b/backend/crypt/crypt.go @@ -396,6 +396,8 @@ type putFn func(ctx context.Context, in io.Reader, src fs.ObjectInfo, options .. // put implements Put or PutStream func (f *Fs) put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options []fs.OpenOption, put putFn) (fs.Object, error) { + ci := fs.GetConfig(ctx) + if f.opt.NoDataEncryption { o, err := put(ctx, in, f.newObjectInfo(src, nonce{}), options...) if err == nil && o != nil { @@ -413,6 +415,9 @@ func (f *Fs) put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options [ // Find a hash the destination supports to compute a hash of // the encrypted data ht := f.Fs.Hashes().GetOne() + if ci.IgnoreChecksum { + ht = hash.None + } var hasher *hash.MultiHasher if ht != hash.None { hasher, err = hash.NewMultiHasherTypes(hash.NewHashSet(ht))