"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
onedrive: fix incorrectly decoded SHA-1
Nick Craig-Wooda63dd6020cf8
diff --git a/onedrive/onedrive.go b/onedrive/onedrive.goindex e1c4ada4c..89a495293 100644--- a/onedrive/onedrive.go+++ b/onedrive/onedrive.go@@ -4,7 +4,6 @@ package onedriveimport ("bytes"- "encoding/base64""fmt""io""log"@@ -14,8 +13,6 @@ import ("sync""time"- "encoding/hex"-"github.com/ncw/rclone/dircache""github.com/ncw/rclone/fs""github.com/ncw/rclone/oauthutil"@@ -727,14 +724,15 @@ func (o *Object) setMetaData(info *api.Item) {o.hasMetaData = trueo.size = info.Size+ // Docs: https://dev.onedrive.com/facets/hashes_facet.htm+ //+ // The docs state both that the hashes are returned as hex+ // strings, and as base64 strings. Testing reveals they are in+ // fact uppercase hex strings.+ //// In OneDrive for Business, SHA1 and CRC32 hash values are not returned for files.if info.File != nil && info.File.Hashes.Sha1Hash != "" {- sha1sumData, err := base64.StdEncoding.DecodeString(info.File.Hashes.Sha1Hash)- if err != nil {- fs.Log(o, "Bad SHA1 decode: %v", err)- } else {- o.sha1 = hex.EncodeToString(sha1sumData)- }+ o.sha1 = strings.ToLower(info.File.Hashes.Sha1Hash)}if info.FileSystemInfo != nil {o.modTime = time.Time(info.FileSystemInfo.LastModifiedDateTime)