From a4a2da477f32d29eda98cc6eb08554dfe5078875 Mon Sep 17 00:00:00 2001 From: Vandra-Meyer Akos Date: Thu, 22 Oct 2026 14:21:56 +0200 Subject: [PATCH] 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 --- lib/model/model.go | 3 +++ lib/model/model_test.go | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/model/model.go b/lib/model/model.go index 4c779494f..19a9029f4 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -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 diff --git a/lib/model/model_test.go b/lib/model/model_test.go index 9676a53a1..da094a44a 100644 --- a/lib/model/model_test.go +++ b/lib/model/model_test.go @@ -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)