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)