From c59fe407958d8134ec098b7b2a63d760cf0d3ec1 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 8 Oct 2020 18:14:53 +0100 Subject: [PATCH] pcloud: only use SHA1 hashes in EU region Apparently only SHA1 hashes are supported in the EU region for pcloud. This has been confirmed by pCloud support. The EU regions also support SHA256 hashes which we don't support yet. https://forum.rclone.org/t/pcloud-to-local-no-hashes-in-common/19440 --- backend/pcloud/api/types.go | 5 +-- backend/pcloud/pcloud.go | 7 ++++ docs/content/overview.md | 64 ++++++++++++++++++++----------------- docs/content/pcloud.md | 7 ++-- 4 files changed, 49 insertions(+), 34 deletions(-) diff --git a/backend/pcloud/api/types.go b/backend/pcloud/api/types.go index 978d51049..b7830996e 100644 --- a/backend/pcloud/api/types.go +++ b/backend/pcloud/api/types.go @@ -104,8 +104,9 @@ type ItemResult struct { // Hashes contains the supported hashes type Hashes struct { - SHA1 string `json:"sha1"` - MD5 string `json:"md5"` + SHA1 string `json:"sha1"` + MD5 string `json:"md5"` + SHA256 string `json:"sha256"` } // UploadFileResponse is the response from /uploadfile diff --git a/backend/pcloud/pcloud.go b/backend/pcloud/pcloud.go index 9254b5a69..26a3bd066 100644 --- a/backend/pcloud/pcloud.go +++ b/backend/pcloud/pcloud.go @@ -885,6 +885,13 @@ func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) { // Hashes returns the supported hash sets. func (f *Fs) Hashes() hash.Set { + // EU region supports SHA1 and SHA256 (but rclone doesn't + // support SHA256 yet). + // + // https://forum.rclone.org/t/pcloud-to-local-no-hashes-in-common/19440 + if f.opt.Hostname == "eapi.pcloud.com" { + return hash.Set(hash.SHA1) + } return hash.Set(hash.MD5 | hash.SHA1) } diff --git a/docs/content/overview.md b/docs/content/overview.md index 88c11376e..8613f9693 100644 --- a/docs/content/overview.md +++ b/docs/content/overview.md @@ -22,7 +22,7 @@ Here is an overview of the major features of each cloud storage system. | Backblaze B2 | SHA1 | Yes | No | No | R/W | | Box | SHA1 | Yes | Yes | No | - | | Citrix ShareFile | MD5 | Yes | Yes | No | - | -| Dropbox | DBHASH † | Yes | Yes | No | - | +| Dropbox | DBHASH ¹ | Yes | Yes | No | - | | FTP | - | No | No | No | - | | Google Cloud Storage | MD5 | Yes | No | No | R/W | | Google Drive | MD5 | Yes | No | Yes | R/W | @@ -31,25 +31,52 @@ Here is an overview of the major features of each cloud storage system. | Hubic | MD5 | Yes | No | No | R/W | | Jottacloud | MD5 | Yes | Yes | No | R/W | | Koofr | MD5 | No | Yes | No | - | -| Mail.ru Cloud | Mailru ‡‡‡ | Yes | Yes | No | - | +| Mail.ru Cloud | Mailru ⁶ | Yes | Yes | No | - | | Mega | - | No | No | Yes | - | | Memory | MD5 | Yes | No | No | - | | Microsoft Azure Blob Storage | MD5 | Yes | No | No | R/W | -| Microsoft OneDrive | SHA1 ‡‡ | Yes | Yes | No | R | -| OpenDrive | MD5 | Yes | Yes | Partial \* | - | +| Microsoft OneDrive | SHA1 ⁵ | Yes | Yes | No | R | +| OpenDrive | MD5 | Yes | Yes | Partial ⁸ | - | | OpenStack Swift | MD5 | Yes | No | No | R/W | -| pCloud | MD5, SHA1 | Yes | No | No | W | +| pCloud | MD5, SHA1 ⁷ | Yes | No | No | W | | premiumize.me | - | No | Yes | No | R | | put.io | CRC-32 | Yes | No | Yes | R | | QingStor | MD5 | No | No | No | R/W | | Seafile | - | No | No | No | - | -| SFTP | MD5, SHA1 ‡ | Yes | Depends | No | - | +| SFTP | MD5, SHA1 ² | Yes | Depends | No | - | | SugarSync | - | No | No | No | - | | Tardigrade | - | Yes | No | No | - | -| WebDAV | MD5, SHA1 ††| Yes ††† | Depends | No | - | +| WebDAV | MD5, SHA1 ³ | Yes ⁴ | Depends | No | - | | Yandex Disk | MD5 | Yes | No | No | R/W | | The local filesystem | All | Yes | Depends | No | - | +### Notes + +¹ Dropbox supports [its own custom +hash](https://www.dropbox.com/developers/reference/content-hash). +This is an SHA256 sum of all the 4MB block SHA256s. + +² SFTP supports checksums if the same login has shell access and +`md5sum` or `sha1sum` as well as `echo` are in the remote's PATH. + +³ WebDAV supports hashes when used with Owncloud and Nextcloud only. + +⁴ WebDAV supports modtimes when used with Owncloud and Nextcloud only. + +⁵ Microsoft OneDrive Personal supports SHA1 hashes, whereas OneDrive +for business and SharePoint server support Microsoft's own +[QuickXorHash](https://docs.microsoft.com/en-us/onedrive/developer/code-snippets/quickxorhash). + +⁶ Mail.ru uses its own modified SHA1 hash + +⁷ pCloud only supports SHA1 (not MD5) in its EU region + +⁸ Opendrive does not support creation of duplicate files using +their web client interface or other stock clients, but the underlying +storage platform has been determined to allow duplicate files, and it +is possible to create them with `rclone`. It may be that this is a +mistake or an unsupported feature. + ### Hash ### The cloud storage system supports various hash types of the objects. @@ -60,23 +87,6 @@ the `check` command. To use the verify checksums when transferring between cloud storage systems they must support a common hash type. -† Note that Dropbox supports [its own custom -hash](https://www.dropbox.com/developers/reference/content-hash). -This is an SHA256 sum of all the 4MB block SHA256s. - -‡ SFTP supports checksums if the same login has shell access and `md5sum` -or `sha1sum` as well as `echo` are in the remote's PATH. - -†† WebDAV supports hashes when used with Owncloud and Nextcloud only. - -††† WebDAV supports modtimes when used with Owncloud and Nextcloud only. - -‡‡ Microsoft OneDrive Personal supports SHA1 hashes, whereas OneDrive -for business and SharePoint server support Microsoft's own -[QuickXorHash](https://docs.microsoft.com/en-us/onedrive/developer/code-snippets/quickxorhash). - -‡‡‡ Mail.ru uses its own modified SHA1 hash - ### ModTime ### The cloud storage system supports setting modification times on @@ -117,12 +127,6 @@ objects with the same name. This confuses rclone greatly when syncing - use the `rclone dedupe` command to rename or remove duplicates. -\* Opendrive does not support creation of duplicate files using -their web client interface or other stock clients, but the underlying -storage platform has been determined to allow duplicate files, and it -is possible to create them with `rclone`. It may be that this is a -mistake or an unsupported feature. - ### Restricted filenames ### Some cloud storage systems might have restrictions on the characters diff --git a/docs/content/pcloud.md b/docs/content/pcloud.md index d4160439e..02f9c239e 100644 --- a/docs/content/pcloud.md +++ b/docs/content/pcloud.md @@ -90,8 +90,11 @@ second. These will be used to detect whether objects need syncing or not. In order to set a Modification time pCloud requires the object be re-uploaded. -pCloud supports MD5 and SHA1 type hashes, so you can use the -`--checksum` flag. +pCloud supports MD5 and SHA1 type hashes in the US region but and SHA1 +only in the EU region, so you can use the `--checksum` flag. + +(Note that pCloud also support SHA256 in the EU region, but rclone +does not have support for that yet.) #### Restricted filename characters