mirror of
https://github.com/rclone/rclone.git
synced 2025-01-19 04:47:54 +02:00
crypt: fix accounting when checking hashes on upload
In e52ecba295333d7ca70307fd7f3779d5b17c29af we forgot to unwrap and re-wrap the accounting which mean the the accounting was no longer first in the chain of readers. This lead to accounting inaccuracies in remotes which wrap and unwrap the reader again.
This commit is contained in:
parent
1b8f4b616c
commit
455219f501
@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/ncw/rclone/fs/accounting"
|
||||
"github.com/ncw/rclone/fs/config/configmap"
|
||||
"github.com/ncw/rclone/fs/config/configstruct"
|
||||
"github.com/ncw/rclone/fs/config/obscure"
|
||||
@ -331,7 +332,13 @@ func (f *Fs) put(in io.Reader, src fs.ObjectInfo, options []fs.OpenOption, put p
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// unwrap the accounting
|
||||
var wrap accounting.WrapFn
|
||||
wrappedIn, wrap = accounting.UnWrap(wrappedIn)
|
||||
// add the hasher
|
||||
wrappedIn = io.TeeReader(wrappedIn, hasher)
|
||||
// wrap the accounting back on
|
||||
wrappedIn = wrap(wrappedIn)
|
||||
}
|
||||
|
||||
// Transfer the data
|
||||
|
Loading…
x
Reference in New Issue
Block a user