"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
fs: fix FixRangeOption to make fetch to end Range options absolute
Nick Craig-Wood1e66d052fd50
diff --git a/fs/open_options.go b/fs/open_options.goindex 8d997118a..268024b17 100644--- a/fs/open_options.go+++ b/fs/open_options.go@@ -158,7 +158,8 @@ func FixRangeOption(options []OpenOption, size int64) {x = &RangeOption{Start: size - x.End, End: -1}options[i] = x}- if x.End > size {+ // If end is too big or undefined, fetch to the end+ if x.End > size || x.End < 0 {x = &RangeOption{Start: x.Start, End: size - 1}options[i] = x}diff --git a/fs/open_options_test.go b/fs/open_options_test.goindex 52fc42ddb..6327a8c9e 100644--- a/fs/open_options_test.go+++ b/fs/open_options_test.go@@ -183,7 +183,7 @@ func TestFixRangeOptions(t *testing.T) {&RangeOption{Start: 1, End: -1},},want: []OpenOption{- &RangeOption{Start: 1, End: -1},+ &RangeOption{Start: 1, End: 99},},size: 100,},@@ -193,7 +193,7 @@ func TestFixRangeOptions(t *testing.T) {&RangeOption{Start: -1, End: 10},},want: []OpenOption{- &RangeOption{Start: 90, End: -1},+ &RangeOption{Start: 90, End: 99},},size: 100,},