"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
sftp: fix hashing files with a newline in their name on rsync.net
Nick Craig-Woodf6d987d74b90
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.goindex bb1fd3b15..7512b8151 100644--- a/backend/sftp/sftp.go+++ b/backend/sftp/sftp.go@@ -2458,7 +2458,14 @@ func (o *Object) Hash(ctx context.Context, r hash.Type) (string, error) {return "", hash.ErrUnsupported}- shellPathArg, err := o.fs.quoteOrEscapeShellPath(o.shellPath())+ shellPath := o.shellPath()+ // Some restricted shells, such as rsync.net's, end the command at a+ // newline even when it is quoted, which would hash a different file.+ if o.fs.shellType == "unix" && strings.Contains(shellPath, "\n") {+ fs.Debugf(o, "Can't calculate %v hash of a name containing a newline", r)+ return "", nil+ }+ shellPathArg, err := o.fs.quoteOrEscapeShellPath(shellPath)if err != nil {return "", fmt.Errorf("failed to calculate %v hash: %w", r, err)}