Skip to content

Commit 1370231

Browse files
committed
fix: 'remove file on all devices' does not work correctly in selective folders (fixes #324)
Signed-off-by: Tommy van der Vorst <tommy@pixelspark.nl>
1 parent 59bcafc commit 1370231

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

SushitrainCore/src/entry.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,5 +479,15 @@ func (entry *Entry) MIMEType() string {
479479
}
480480

481481
func (entry *Entry) Remove() error {
482-
return entry.Folder.deleteAndDeselectLocalFile(entry.Path())
482+
path := entry.Path()
483+
err := entry.Folder.deleteLocalFileAndRedundantChildren(path)
484+
if err != nil {
485+
return err
486+
}
487+
containingDir := filepath.Dir(path)
488+
return entry.Folder.RescanSubdirectory(containingDir)
489+
// In selective folders, the entry will remain selected until the app cleans the entry in .stignore up.
490+
// It would be better to also deselect the file immediately after the deletion has been picked up by Syncthing,
491+
// but there appears not to be a reliable way to do this. Hence deleted files may become unintentionally selected
492+
// again if another peer re-adds them.
483493
}

SushitrainCore/src/folder.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -964,25 +964,6 @@ func (fld *Folder) deleteLocalFileAndRedundantChildren(path string) error {
964964
return nil
965965
}
966966

967-
func (fld *Folder) deleteAndDeselectLocalFile(path string) error {
968-
err := fld.deleteLocalFileAndRedundantChildren(path)
969-
if err != nil {
970-
return err
971-
}
972-
973-
err = fld.client.app.Internals.ScanFolderSubdirs(fld.FolderID, []string{path})
974-
if err != nil {
975-
return err
976-
}
977-
978-
err = fld.SetLocalFileExplicitlySelected(path, false)
979-
if err != nil {
980-
return err
981-
}
982-
983-
return nil
984-
}
985-
986967
func (fld *Folder) reloadIgnores() error {
987968
if !fld.IsPaused() {
988969
err := fld.SetPaused(true)

0 commit comments

Comments
 (0)