From 1cb31e8cc71ad096565d74469ebe63a5b58fe6de Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 1 Aug 2021 14:24:05 +0100 Subject: [PATCH] crypt: fix uploads with --crypt-no-data-encryption Before this change, when uploading to a crypt, the ObjectInfo accidentally used the encrypted size, not the unencrypted size when --crypt-no-data-encryption was set. Fixes #5498 --- backend/crypt/crypt.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/crypt/crypt.go b/backend/crypt/crypt.go index 227a42587..2c40a1835 100644 --- a/backend/crypt/crypt.go +++ b/backend/crypt/crypt.go @@ -999,6 +999,9 @@ func (o *ObjectInfo) Size() int64 { if size < 0 { return size } + if o.f.opt.NoDataEncryption { + return size + } return o.f.cipher.EncryptedSize(size) }