From 7190c058a76dfd50e006c7e63ddef475bd2248f2 Mon Sep 17 00:00:00 2001 From: Ivan Andreev Date: Mon, 11 Oct 2021 17:03:55 +0300 Subject: [PATCH] crypt: return wrapped object even with no-data-encryption In presence of no_data_encryption the Crypt's Put method used to over-optimize and returned base object. This patch makes it return Crypt-wrapped object now. Fixes #5498 --- backend/crypt/crypt.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/crypt/crypt.go b/backend/crypt/crypt.go index 14d7915cb..227a42587 100644 --- a/backend/crypt/crypt.go +++ b/backend/crypt/crypt.go @@ -363,7 +363,11 @@ 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) { if f.opt.NoDataEncryption { - return put(ctx, in, f.newObjectInfo(src, nonce{}), options...) + o, err := put(ctx, in, f.newObjectInfo(src, nonce{}), options...) + if err == nil && o != nil { + o = f.newObject(o) + } + return o, err } // Encrypt the data into wrappedIn