mirror of
https://github.com/Glitchy-Sheep/boosty-downloader.git
synced 2026-10-14 21:33:23 +00:00
[PR #140] [MERGED] [downloader] Fit every generated name into the filesystem limit #144
Labels
No labels
api-drift
bug
ci
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Glitchy-Sheep/boosty-downloader#144
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Glitchy-Sheep/boosty-downloader/pull/140
Author: @Glitchy-Sheep
Created: 8/14/2026
Status: ✅ Merged
Merged: 8/14/2026
Merged by: @Glitchy-Sheep
Base:
main← Head:fix/long-filenames📝 Commits (6)
2c05aadfix: Add byte-aware filename sanitizer and a path-limits reference1e79644fix: Compose post folder names through the byte-aware sanitizer12420c5fix: Keep file extensions and video ids when truncating long filenames3fdecbbfix: Cap external video titles so yt-dlp names fit the filesystem limit8a5609dfeat: Hint at a shorter destination path on OS path-length errors3013f2adocs: Note the long-filename fix in the changelog📊 Changes
14 files changed (+489 additions, -39 deletions)
View changed files
📝
CHANGELOG.md(+8 -0)📝
boosty_downloader/src/application/use_cases/download_all_posts.py(+13 -15)📝
boosty_downloader/src/application/use_cases/download_single_post.py(+29 -1)📝
boosty_downloader/src/application/use_cases/download_specific_post.py(+8 -8)📝
boosty_downloader/src/infrastructure/external_videos_downloader/external_videos_downloader.py(+14 -2)📝
boosty_downloader/src/infrastructure/file_downloader.py(+20 -7)📝
boosty_downloader/src/infrastructure/path_sanitizer.py(+72 -6)➕
docs/concepts/filesystem-path-limits.md(+70 -0)➕
test/unit/external_videos_downloader/title_limit_test.py(+29 -0)➕
test/unit/file_downloader/filename_truncation_test.py(+42 -0)➕
test/unit/path_sanitizer/path_sanitizer_test.py(+82 -0)➕
test/unit/path_sanitizer/path_too_long_error_test.py(+42 -0)📝
test/unit/use_cases/download_all_posts_test.py(+18 -0)➕
test/unit/use_cases/post_directory_name_test.py(+42 -0)📄 Description
Closes #93
Summary
Long post titles crashed the download with
OSError: File name too long. Filesystems cap one name at 255 bytes, and Cyrillic takes 2 bytes per letter in UTF-8 - so a title of 128 Russian letters was already over the limit. Now every name the app generates is cut to a 240-byte budget, and the parts that matter - the post date, the dedup id and the file extension - always survive the cut.Problem
<>:"/\|?*; newlines from real post titles stayed in folder names (illegal on Windows), and a title of pure emoji produced a hidden file like.mp4(id8)dedup tail and file extensions, reviving #104 and #75downloadadded(id8),--post-urldid not.replace('.', '')hack mangled titles: "v2.0" became "v20"Fix
sanitize_filename(name, suffix, max_bytes): NFC normalization, control chars and unsafe chars removed, trailing dots and spaces stripped, Windows reserved names prefixed, byte truncation that never splits a UTF-8 char - and asuffix(extension or dedup id) that never gets truncated awaydate - title (id8)through one helper; only the title part is ever cutENAMETOOLONGand WindowsWinError 206even under error wrappersdocs/concepts/filesystem-path-limits.md: a practical reference of per-system limits, with real paths that fit and failBefore / After
Before: a post titled with 130 Cyrillic letters fails on Linux with a raw
OSError: [Errno 36] File name too long, lands in the failed log with no advice, and the same post gets different folders viadownloadand--post-url.After: the folder is
2026-08-14 - яяя...я (a2dd6942)at 240 bytes, both paths agree on it,archive.zipcut from a long title still ends with.zip, and a genuine path-length error tells the user what to do.Compatibility
Verification
'я' * 300as a title) failsmkdirwith a raw name and succeeds with the composed one at exactly 240 bytes with the id tail intacterrno 63) and stays silent on unrelated errorstask check(ruff, format, pyright) andtask buildgreenNotes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.