Turn filename separators into dashes rather than dropping them

Splits the forbidden set: / \ | : were separating words, so they become
"-"; ? * < > " ' just go. Runs of dashes and spaces collapse to " - "
when the run held whitespace and to a bare "-" when it did not, so
"Show | Series" reads "Show - Series" while "AC/DC" stays "AC-DC".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RPyeapneuXrCdojsaiXGbe
This commit is contained in:
2026-09-10 00:40:17 +00:00
parent c12e8ca19c
commit ed47e456d4
2 changed files with 62 additions and 23 deletions

View File

@@ -41,8 +41,21 @@ episode -- whole-percent throttling behaving exactly as intended -- then `downlo
**Fixed: stripped separators left doubled spaces.** The feed title separates words with `|`, a
forbidden filename character, so the folder came out `Get in the Trunk Anthology Series Delta
Green`. `sanitize()` now collapses runs of whitespace (and maps control characters to a space
rather than deleting them). The Python had the same wart.
Green`. The Python had the same wart.
Forbidden characters are now split in two. Separators (`/ \\ | :`) become `-`; the rest
(`? * < > " '`) are simply dropped. A run of dashes and spaces then collapses to `" - "` when the
run contained whitespace and to a bare `-` when it did not, so:
| input | output |
|---|---|
| `Get in the Trunk \| Anthology Series \| Delta Green` | `Get in the Trunk - Anthology Series - Delta Green` |
| `Ep 12: The One` | `Ep 12 - The One` |
| `AC/DC` | `AC-DC` |
| `well-known.mp3` | `well-known.mp3` |
| `../../etc/passwd` | `etc-passwd` |
Leading dashes and dots are trimmed too -- a filename starting with `-` trips up CLI tools.
**Worth knowing, not a bug:**