mirror of
https://github.com/vladmandic/automatic
synced 2026-09-17 08:19:11 +02:00
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:
+5
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user