serve sftp: document legacy code for checksum detection

See #6351
This commit is contained in:
albertony 2022-08-04 16:31:16 +02:00
parent 5a6d233924
commit 6b158f33a3

View File

@ -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) {