forked from kenzuya/unshackle
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:
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user