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

local: fix -L/--copy-links with filters missing directories

Nick Craig-Wooda61d219bcd3f
diff --git a/backend/local/local.go b/backend/local/local.go
index 8d16ad4a8..67784f8e6 100644
--- a/backend/local/local.go
+++ b/backend/local/local.go
@@ -520,11 +520,6 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
name := fi.Name()
mode := fi.Mode()
newRemote := f.cleanRemote(dir, name)
- // Don't include non directory if not included
- // we leave directory filtering to the layer above
- if useFilter && !fi.IsDir() && !filter.IncludeRemote(newRemote) {
- continue
- }
// Follow symlinks if required
if f.opt.FollowSymlinks && (mode&os.ModeSymlink) != 0 {
localPath := filepath.Join(fsDirPath, name)
@@ -541,6 +536,11 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
}
mode = fi.Mode()
}
+ // Don't include non directory if not included
+ // we leave directory filtering to the layer above
+ if useFilter && !fi.IsDir() && !filter.IncludeRemote(newRemote) {
+ continue
+ }
if fi.IsDir() {
// Ignore directories which are symlinks. These are junction points under windows which
// are kind of a souped up symlink. Unix doesn't have directories which are symlinks.