mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-20 09:36:16 +00:00
fix(datastore): prefer named default entry when two default dirs collide in ListAllDevices
When the same device appears under `default/` in two separate data dirs (e.g. primary DataDir and the legacy st-go/data path), the first-seen entry was kept unconditionally even when it had an empty name. A subsequent default entry carrying a real name was silently dropped, causing name loss in SyncFromAccountFull. Addresses TestReproduceMissingName regression introduced by the dedup-default-last change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
fa2f7cd17d
commit
2b50ef0c98
@@ -681,7 +681,14 @@ func (ds *DataStore) ListAllDevices() ([]models.ServiceDeviceInfo, error) {
|
||||
}
|
||||
|
||||
// "default" never replaces a real-account entry.
|
||||
// But when two "default" entries collide across data dirs,
|
||||
// prefer the one with a non-empty name (more information).
|
||||
if info.AccountID == accountIDDefault {
|
||||
if entry.account == accountIDDefault && devices[entry.index].Name == "" && info.Name != "" {
|
||||
devices[entry.index] = info
|
||||
seenIDs[key] = seenEntry{index: entry.index, account: info.AccountID}
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user