Lowercase + hyphenate into a filesystem-safe slug (export.tsx:43-49).
(text: str)
| 130 | |
| 131 | |
| 132 | def sanitize_filename(text: str) -> str: |
| 133 | """Lowercase + hyphenate into a filesystem-safe slug (export.tsx:43-49).""" |
| 134 | s = text.lower() |
| 135 | s = re.sub(r"[^a-z0-9\s-]", "", s) # drop special chars |
| 136 | s = re.sub(r"\s+", "-", s) # spaces -> hyphens |
| 137 | s = re.sub(r"-+", "-", s) # collapse repeated hyphens |
| 138 | s = re.sub(r"^-|-$", "", s) # trim leading/trailing hyphens |
| 139 | return s |
| 140 | |
| 141 | |
| 142 | def _default_filename(messages: Any) -> str: |
no outgoing calls