lib/config, lib/connections: Refactor handling of ignored devices (fixes #3470)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3471
This commit is contained in:
committed by
Audrius Butkevicius
parent
1eb6db6ca8
commit
f368d2278f
@@ -273,6 +273,16 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) error {
|
||||
cfg.GUI.APIKey = rand.String(32)
|
||||
}
|
||||
|
||||
// The list of ignored devices should not contain any devices that have
|
||||
// been manually added to the config.
|
||||
newIgnoredDevices := []protocol.DeviceID{}
|
||||
for _, dev := range cfg.IgnoredDevices {
|
||||
if !existingDevices[dev] {
|
||||
newIgnoredDevices = append(newIgnoredDevices, dev)
|
||||
}
|
||||
}
|
||||
cfg.IgnoredDevices = newIgnoredDevices
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user