Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

serve sftp: document legacy code for checksum detection

albertony6b158f33a3df
diff --git a/cmd/serve/sftp/connection.go b/cmd/serve/sftp/connection.go
index d9eaf855d..42564c151 100644
--- a/cmd/serve/sftp/connection.go
+++ b/cmd/serve/sftp/connection.go
@@ -135,7 +135,13 @@ func (c *conn) execCommand(ctx context.Context, out io.Writer, command string) (
return fmt.Errorf("send output failed: %w", err)
}
case "echo":
- // special cases for rclone command detection
+ // Special cases for legacy rclone command detection.
+ // Before rclone v1.49.0 the sftp backend used "echo 'abc' | md5sum" when
+ // detecting hash support, but was then changed to instead just execute
+ // md5sum/sha1sum (without arguments), which is handled above. The following
+ // code is therefore only necessary to support rclone versions older than
+ // v1.49.0 using a sftp remote connected to a rclone serve sftp instance
+ // running a newer version of rclone (e.g. latest).
switch args {
case "'abc' | md5sum":
if c.vfs.Fs().Hashes().Contains(hash.MD5) {