Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

b2: Fix SHA1 mismatch when downloading files with no SHA1 #678

Nick Craig-Wood8207af9460fa
diff --git a/b2/b2.go b/b2/b2.go
index bc93ac7ae..cbdfc9e79 100644
--- a/b2/b2.go
+++ b/b2/b2.go
@@ -1133,7 +1133,7 @@ func (file *openFile) Close() (err error) {
// Check the SHA1
receivedSHA1 := file.o.sha1
calculatedSHA1 := fmt.Sprintf("%x", file.hash.Sum(nil))
- if receivedSHA1 != calculatedSHA1 {
+ if receivedSHA1 != "" && receivedSHA1 != calculatedSHA1 {
return errors.Errorf("object corrupted on transfer - SHA1 mismatch (want %q got %q)", receivedSHA1, calculatedSHA1)
}