fix: preserve spaces in sanitized filenames

Remove space from structural chars regex so spaces are kept as-is
rather than being replaced with the spacer character.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-20 00:17:20 +07:00
parent 8cefca84e9
commit 0c370c7738

View File

@@ -131,7 +131,7 @@ def sanitize_filename(filename: str, spacer: str = ".") -> str:
# From original repo. # From original repo.
# if spacer == ".": # if spacer == ".":
# filename = re.sub(r" - ", spacer, filename) # title separators to spacer (avoids .-. pattern) # filename = re.sub(r" - ", spacer, filename) # title separators to spacer (avoids .-. pattern)
filename = re.sub(r"[:; ]", spacer, filename) # structural chars to (spacer) filename = re.sub(r"[:;]", spacer, filename) # structural chars to (spacer)
filename = re.sub(r"[\\*!?¿,'\"" "()<>|$#~]", "", filename) # not filename safe chars filename = re.sub(r"[\\*!?¿,'\"" "()<>|$#~]", "", filename) # not filename safe chars
# filename = re.sub(rf"[{spacer}]{{2,}}", spacer, filename) # remove extra neighbouring (spacer)s # filename = re.sub(rf"[{spacer}]{{2,}}", spacer, filename) # remove extra neighbouring (spacer)s