This commit is contained in:
2026-03-25 22:39:30 -07:00
parent c31402c8f1
commit 562acd809c
46 changed files with 2367 additions and 1868 deletions

View File

@@ -39,6 +39,7 @@ _WINDOWS_RESERVED_NAMES = {
*(f"com{i}" for i in range(1, 10)),
*(f"lpt{i}" for i in range(1, 10)),
}
_ILLEGAL_FILENAME_CHARS_RE = re.compile(r'[<>:"/\\|?*]')
def _sanitize_filename_base(text: str) -> str:
@@ -48,7 +49,7 @@ def _sanitize_filename_base(text: str) -> str:
return "table"
# Replace characters illegal on Windows (and generally unsafe cross-platform).
s = re.sub(r'[<>:"/\\|?*]', " ", s)
s = _ILLEGAL_FILENAME_CHARS_RE.sub(" ", s)
# Drop control characters.
s = "".join(ch for ch in s if ch.isprintable())