fix(model): skip ignored folders when auto-accepting (fixes #10935)

Auto-accept ran before the check for ignored folders, so a folder in
the device's ignored folders was still accepted when the device
announced it. After that, the config cleanup removed the ignore entry,
because the folder existed again.

The docs say that an ignored folder is always skipped when the device
announces it. Skip ignored folders in the auto-accept loop too.

Signed-off-by: Vandra-Meyer Akos <[email protected]>
This commit is contained in:
Vandra-Meyer Akos authored and Jakob Borg committed 2026-10-23 07:03:25 +02:00
1 parent d6d0181f7d
commit a4a2da477f
2 files changed
+18

No files matched your search

+3
View File
@@ -1264,6 +1264,9 @@ func (m *model) ClusterConfig(conn protocol.Connection, cm *protocol.ClusterConf
changedFcfg := make(map[string]config.FolderConfiguration)
haveFcfg := cfg.FolderMap()
for _, folder := range cm.Folders {
if deviceCfg.IgnoredFolder(folder.ID) {
continue
}
from, ok := haveFcfg[folder.ID]
if to, changed := m.handleAutoAccepts(deviceID, folder, ccDeviceInfos[folder.ID], from, ok, cfg.Defaults.Folder); changed {
changedFcfg[folder.ID] = to
+15
View File
@@ -1106,6 +1106,21 @@ func TestAutoAcceptRejected(t *testing.T) {
}
}
func TestAutoAcceptIgnoredFolder(t *testing.T) {
// Nothing happens if the folder is ignored for the device
id := srand.String(8)
tcfg := defaultAutoAcceptCfg.Copy()
tcfg.Devices[1].IgnoredFolders = []config.ObservedFolder{{ID: id}}
m, cancel := newState(t, tcfg)
defer cleanupModel(m)
defer cancel()
m.ClusterConfig(device1Conn, createClusterConfig(device1, id))
if _, ok := m.cfg.Folder(id); ok {
t.Error("unexpected folder", id)
}
}
func TestAutoAcceptNewFolder(t *testing.T) {
// New folder
m, cancel := newState(t, defaultAutoAcceptCfg)