fix(key_utils): drop apostrophes in generate_key_from_folder
This commit is contained in:
@@ -10,7 +10,6 @@ import unicodedata
|
|||||||
import uuid
|
import uuid
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
# Valid key pattern: alphanumeric, hyphens, underscores
|
# Valid key pattern: alphanumeric, hyphens, underscores
|
||||||
# Must be at least 1 char, URL-safe
|
# Must be at least 1 char, URL-safe
|
||||||
VALID_KEY_PATTERN = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_-]*$')
|
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)
|
parts.append(char)
|
||||||
elif char.isspace():
|
elif char.isspace():
|
||||||
parts.append(' ')
|
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:
|
else:
|
||||||
parts.append(' ')
|
parts.append(' ')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user