mirror of
https://github.com/rclone/rclone.git
synced 2024-11-23 03:57:14 +08:00
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:
parent
2515039e18
commit
2e54b56a01
|
@ -1391,11 +1391,14 @@ func Rcat(ctx context.Context, fdst fs.Fs, dstFileName string, in io.ReadCloser,
|
||||||
|
|
||||||
compare := func(dst fs.Object) error {
|
compare := func(dst fs.Object) error {
|
||||||
var sums map[hash.Type]string
|
var sums map[hash.Type]string
|
||||||
|
opt := defaultEqualOpt(ctx)
|
||||||
if hasher != nil {
|
if hasher != nil {
|
||||||
|
// force --checksum on if we have hashes
|
||||||
|
opt.checkSum = true
|
||||||
sums = hasher.Sums()
|
sums = hasher.Sums()
|
||||||
}
|
}
|
||||||
src := object.NewStaticObjectInfo(dstFileName, modTime, int64(readCounter.BytesRead()), false, sums, fdst)
|
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 = fmt.Errorf("corrupted on transfer")
|
||||||
err = fs.CountError(err)
|
err = fs.CountError(err)
|
||||||
fs.Errorf(dst, "%v", err)
|
fs.Errorf(dst, "%v", err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user