fix(styles): key style dict by prefixed name to prevent nested collisions

Styles in nested subfolders that shared a base JSON name were being
overwritten because load_style keyed self.styles by the raw style["name"]
while the Style object stored the prefixed name. The extra networks page
iterates dict keys, so only one card per name surfaced.

Key the dict by the same prefixed name, and warn when a true duplicate
(same prefix and same name) is still detected.
This commit is contained in:
CalamitousFelicitousness
2026-05-25 02:05:37 +01:00
parent 1061eaf815
commit 566b6629bd
+5 -1
View File
@@ -331,7 +331,11 @@ class StyleDatabase:
filename=fn,
mtime=os.path.getmtime(fn),
)
self.styles[style["name"]] = new_style
# key by the prefixed name so styles with the same base name in different
# subfolders do not collide and overwrite each other
if name in self.styles:
log.warning(f'Style duplicate name: name="{name}" file="{fn}" existing="{self.styles[name].filename}"')
self.styles[name] = new_style
except Exception as e:
log.error(f'Failed to load style: file="{fn}" error={e}')
return new_style