fix(output): treat / and \ as folder separators on any OS

Split folder templates on both separators and format each segment separately so sanitize_filename never rewrites the divider; validate folder.* templates per-segment.
This commit is contained in:
sp4rk.y
2026-06-25 16:03:27 -06:00
parent 4539f63106
commit 2ed243aae4
5 changed files with 21 additions and 26 deletions
+5 -1
View File
@@ -213,7 +213,11 @@ class Config:
warnings.warn(f"Unknown template variable '{var}' in {template_type} template")
test_template = re.sub(r"\{[^}]+\}", "TEST", template_str)
if re.search(unsafe_chars, test_template):
if template_type.startswith("folder"):
unsafe_segment = any(re.search(unsafe_chars, seg) for seg in re.split(r"[\\/]", test_template))
else:
unsafe_segment = bool(re.search(unsafe_chars, test_template))
if unsafe_segment:
warnings.warn(f"Template '{template_type}' may contain filesystem-unsafe characters")
if not template_str.strip():