rcat: check checksums by default like copy does #6305

Before this change we were calculating the checksum for an rcat
transfer but never checking it.

See: https://forum.rclone.org/t/optimize-rclone-on-raspberry-pi-4-8gb/31741
This commit is contained in:
Nick Craig-Wood 2022-07-07 11:31:53 +01:00
parent 2515039e18
commit 2e54b56a01

View file

@ -1391,11 +1391,14 @@ func Rcat(ctx context.Context, fdst fs.Fs, dstFileName string, in io.ReadCloser,
compare := func(dst fs.Object) error {
var sums map[hash.Type]string
opt := defaultEqualOpt(ctx)
if hasher != nil {
// force --checksum on if we have hashes
opt.checkSum = true
sums = hasher.Sums()
}
src := object.NewStaticObjectInfo(dstFileName, modTime, int64(readCounter.BytesRead()), false, sums, fdst)
if !Equal(ctx, src, dst) {
if !equal(ctx, src, dst, opt) {
err = fmt.Errorf("corrupted on transfer")
err = fs.CountError(err)
fs.Errorf(dst, "%v", err)