"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
Fix --files-from with an empty file copying everything - fixes #1196
Nick Craig-Wood10e532bce933
diff --git a/fs/filter.go b/fs/filter.goindex e35812f96..ba9150c2f 100644--- a/fs/filter.go+++ b/fs/filter.go@@ -212,6 +212,7 @@ func NewFilter() (f *Filter, err error) {}if filesFrom != nil {for _, rule := range *filesFrom {+ f.initAddFile() // init to show --files-from set even if no files withinerr := forEachLine(rule, func(line string) error {return f.AddFile(line)})@@ -323,12 +324,17 @@ func (f *Filter) AddRule(rule string) error {return errors.Errorf("malformed rule %q", rule)}-// AddFile adds a single file to the files from list-func (f *Filter) AddFile(file string) error {+// initAddFile creates f.files and f.dirs+func (f *Filter) initAddFile() {if f.files == nil {f.files = make(FilesMap)f.dirs = make(FilesMap)}+}++// AddFile adds a single file to the files from list+func (f *Filter) AddFile(file string) error {+ f.initAddFile()file = strings.Trim(file, "/")f.files[file] = struct{}{}// Put all the parent directories into f.dirs