From 02d6d28ec4844f9b42b336173a235f1e88c3716f Mon Sep 17 00:00:00 2001 From: Ole Frost <82263101+olefrost@users.noreply.github.com> Date: Wed, 11 Jan 2023 13:42:43 +0100 Subject: [PATCH] crypt: fix for unencrypted directory names on case insensitive remotes rclone sync erroneously deleted folders renamed to a different case on crypts where directory name encryption was disabled and the underlying remote was case insensitive. Example: Renaming the folder Test to tEST before a sync to a crypt having remote=OneDrive:crypt and directory_name_encryption=false could result in the folder and all its content being deleted. The following sync would correctly create the tEST folder and upload all of the content. Additional tests have revealed other potential issues when using filename_encryption=off or directory_name_encryption=false on case insensitive remotes. The documentation has been updated to warn about potential problems when using these combinations. --- backend/crypt/crypt.go | 2 +- docs/content/crypt.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/crypt/crypt.go b/backend/crypt/crypt.go index b1c8111d0..f3eb8317d 100644 --- a/backend/crypt/crypt.go +++ b/backend/crypt/crypt.go @@ -235,7 +235,7 @@ func NewFs(ctx context.Context, name, rpath string, m configmap.Mapper) (fs.Fs, // the features here are ones we could support, and they are // ANDed with the ones from wrappedFs f.features = (&fs.Features{ - CaseInsensitive: cipher.NameEncryptionMode() == NameEncryptionOff, + CaseInsensitive: !cipher.dirNameEncrypt || cipher.NameEncryptionMode() == NameEncryptionOff, DuplicateFiles: true, ReadMimeType: false, // MimeTypes not supported with crypt WriteMimeType: false, diff --git a/docs/content/crypt.md b/docs/content/crypt.md index 813aa0830..2b0550246 100644 --- a/docs/content/crypt.md +++ b/docs/content/crypt.md @@ -455,6 +455,7 @@ Properties: - "off" - Don't encrypt the file names. - Adds a ".bin" extension only. + - May cause problems on [case insensitive](/overview/#case-insensitive) [storage systems](/overview/#features) like OneDrive, Dropbox, Windows, OSX and SMB. #### --crypt-directory-name-encryption @@ -473,6 +474,7 @@ Properties: - Encrypt directory names. - "false" - Don't encrypt directory names, leave them intact. + - May cause problems on [case insensitive](/overview/#case-insensitive) [storage systems](/overview/#features) like OneDrive, Dropbox, Windows, OSX and SMB. #### --crypt-password