mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
handle invalid filenames in styles
This commit is contained in:
+3
-1
@@ -98,7 +98,9 @@ class StyleDatabase:
|
||||
"extra": "",
|
||||
"preview": "",
|
||||
}
|
||||
fn = os.path.join(path, name + ".json")
|
||||
keepcharacters = (' ','.','_')
|
||||
fn = "".join(c for c in name if c.isalnum() or c in keepcharacters).rstrip()
|
||||
fn = os.path.join(path, fn + ".json")
|
||||
try:
|
||||
with open(fn, 'w', encoding='utf-8') as f:
|
||||
json.dump(style, f, indent=2)
|
||||
|
||||
Reference in New Issue
Block a user