From 0c370c7738dda7bb7ba28589a7f7c042967e36d5 Mon Sep 17 00:00:00 2001 From: Andhika Darnaputra Date: Sat, 20 Dec 2025 00:17:20 +0700 Subject: [PATCH] fix: preserve spaces in sanitized filenames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- unshackle/core/utilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unshackle/core/utilities.py b/unshackle/core/utilities.py index 22c0b75..c04150b 100644 --- a/unshackle/core/utilities.py +++ b/unshackle/core/utilities.py @@ -131,7 +131,7 @@ def sanitize_filename(filename: str, spacer: str = ".") -> str: # From original repo. # if spacer == ".": # 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(rf"[{spacer}]{{2,}}", spacer, filename) # remove extra neighbouring (spacer)s