From 765e43c6847fe08d7aa3ec49cb16fe80daa16296 Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 29 May 2026 18:20:20 +0200 Subject: [PATCH] fix(key_utils): drop apostrophes in generate_key_from_folder --- src/core/utils/key_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/utils/key_utils.py b/src/core/utils/key_utils.py index 70258ce..947d2f8 100644 --- a/src/core/utils/key_utils.py +++ b/src/core/utils/key_utils.py @@ -10,7 +10,6 @@ import unicodedata import uuid from typing import Optional - # Valid key pattern: alphanumeric, hyphens, underscores # Must be at least 1 char, URL-safe VALID_KEY_PATTERN = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$') @@ -102,6 +101,11 @@ def generate_key_from_folder(folder_name: str) -> str: parts.append(char) elif char.isspace(): parts.append(' ') + # Handle apostrophes - treat as part of word (remove, don't replace with space) + # This normalizes e.g., "Hell's" -> "Hells" + # Includes: ' (0x27), ' (0x2018), ' (0x2019), ' (0x02BC), ` (0x0060) + elif char in ("'", "'", "'", "'", "`", """, """): + pass # Skip - drop the apostrophe else: parts.append(' ')