fs: Verify sizes are the same after transfer in Copy()

This commit is contained in:
Nick Craig-Wood 2014-07-19 12:38:58 +01:00
parent 1c472348b6
commit e559194fb2

View File

@ -142,6 +142,15 @@ func Copy(f Fs, dst, src Object) {
return
}
// Verify sizes are the same after transfer
if src.Size() != dst.Size() {
Stats.Error()
err = fmt.Errorf("Corrupted on transfer: sizes differ %d vs %d", src.Size(), dst.Size())
Log(dst, "%s", err)
removeFailedCopy(dst)
return
}
// Verify md5sums are the same after transfer - ignoring blank md5sums
srcMd5sum, md5sumErr := src.Md5sum()
if md5sumErr != nil {