From 4ac4ce6afdf35e71f13a6b561195c342d440828d Mon Sep 17 00:00:00 2001 From: nielash Date: Tue, 11 Jul 2023 05:09:07 -0400 Subject: [PATCH] bisync: apply filters correctly during deletes Fixed an issue causing bisync to consider more files than necessary due to overbroad filters during delete operations https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=5.%20Bisync%20reads%20files%20in%20excluded%20directories%20during%20delete%20operations --- cmd/bisync/queue.go | 9 ++++++++- docs/content/bisync.md | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/bisync/queue.go b/cmd/bisync/queue.go index 08bb20862..33db28f10 100644 --- a/cmd/bisync/queue.go +++ b/cmd/bisync/queue.go @@ -32,7 +32,14 @@ func (b *bisyncRun) fastDelete(ctx context.Context, f fs.Fs, files bilib.Names, } transfers := fs.GetConfig(ctx).Transfers - ctxRun := b.opt.setDryRun(ctx) + + ctxRun, filterDelete := filter.AddConfig(b.opt.setDryRun(ctx)) + + for _, file := range files.ToList() { + if err := filterDelete.AddFile(file); err != nil { + return err + } + } objChan := make(fs.ObjectsChan, transfers) errChan := make(chan error, 1) diff --git a/docs/content/bisync.md b/docs/content/bisync.md index 4f8422510..3ad5bedd8 100644 --- a/docs/content/bisync.md +++ b/docs/content/bisync.md @@ -1119,3 +1119,5 @@ about _Unison_ and synchronization in general. * Fixed an [issue](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=1.%20Dry%20runs%20are%20not%20completely%20dry) causing dry runs to inadvertently commit filter changes * `--check-access` is now enforced during `--resync`, preventing data loss in [certain user error scenarios](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=%2D%2Dcheck%2Daccess%20doesn%27t%20always%20fail%20when%20it%20should) +* Fixed an [issue](https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=5.%20Bisync%20reads%20files%20in%20excluded%20directories%20during%20delete%20operations) +causing bisync to consider more files than necessary due to overbroad filters during delete operations