mediago-dev--mediago
c34812841e
Twitter-style page titles like "(2) 主页 / X" land a literal "/" in the download filename. Gopeed used to strip such characters silently; aria2 is strict and passes them through to the OS, which then reads "/" as a path separator — the save ends up at `.../(2) 主页 /X-....mp4` pointing at a non-existent sub-directory and fails with `ERROR_PATH_NOT_FOUND (errNum=3)`. Sanitize once, at the task-creation boundary, so the DB row, the downloader command-line `-o` arg, and the post-download `CheckFileExists(rec.Name, ...)` probe all agree on the same filesystem-safe value. - New exported `core.SanitizeFilename` replaces reserved path / wildcard characters (`\ / : * ? " < > |`) and ASCII control chars with `_`, and right-trims dots / spaces (Windows strips those silently, producing a filename that doesn't match the DB row). Falls back to "download" if every character was illegal. - `service/download_task.go` `AddDownloadTask` and `AddDownloadTasks` run titles through `SanitizeFilename` before the `FindByName` de-duplication check, so both the dedup lookup and the persisted row see the cleaned value. - `core/downloader.go` `buildArgs` still calls `SanitizeFilename` defensively on `p.Name` — cheap, and guards any future path that bypasses the service layer. Applies to every downloader (aria2, yt-dlp, BBDown, N_m3u8DL-RE, mediago) since the fix is in the shared `name` arg-building branch used by all Schema entries. Pre-existing broken tasks in the DB will still fail "file not found" on the UI and need to be deleted + re-created. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>