From 8d1d096c112ff26967496fd166697515fdf4b7b9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 12 Aug 2024 20:23:19 +0100 Subject: [PATCH] drive: fix copying Google Docs to a backend which only supports SHA1 When copying Google Docs to Backblaze B2 errors like this would happen ERROR : test.docx: Failed to calculate src hash: hash type not supported ERROR : test.docx: corrupted on transfer: sha1 hashes differ src This was due to an oversight in 8fd66daab671bb98 drive: add support of SHA-1 and SHA-256 checksum Which omitted to change the base object (which includes Google Docs) so that it supported SHA-1 and SHA-256. --- backend/drive/drive.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/drive/drive.go b/backend/drive/drive.go index 30e930f38..271b0b046 100644 --- a/backend/drive/drive.go +++ b/backend/drive/drive.go @@ -3965,7 +3965,7 @@ func (o *Object) Hash(ctx context.Context, t hash.Type) (string, error) { return "", hash.ErrUnsupported } func (o *baseObject) Hash(ctx context.Context, t hash.Type) (string, error) { - if t != hash.MD5 { + if t != hash.MD5 && t != hash.SHA1 && t != hash.SHA256 { return "", hash.ErrUnsupported } return "", nil