fix: cap path components at the filesystem byte limit - #1
Merged
Conversation
Album and track names came from Tidal untouched except for illegal
characters, so a release whose title runs to hundreds of bytes produced a
path component over the 255-byte limit APFS/ext4/NTFS enforce, and the
download failed with "file name too long". Heavily decorated titles hit
this while looking short: combining marks and CJK run several bytes per
rune.
Cap components at 200 bytes, truncating on a rune boundary so a
multi-byte rune is never split. The 55 bytes of headroom cover the
suffixes the download path appends to a sanitized base (".raw.flac",
os.CreateTemp's ".dl-<random>").
internal/tidal and internal/convert each carried an identical copy of
sanitize; both now call a shared internal/fsname so the limit is defined
once.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Album and track names came from Tidal untouched except for illegal characters, so a release whose title runs to hundreds of bytes produced a path component over the 255-byte limit APFS/ext4/NTFS enforce — the download failed with
file name too long. Heavily decorated titles (combining marks, CJK, emoji) hit this while looking short, since they run several bytes per rune.Triggered by a real download: a 100 gecs release whose album directory name alone was 475 bytes.
Fix
.raw.flac,os.CreateTemp's.dl-<random>).internal/tidalandinternal/converteach carried an identical copy ofsanitize; both now call a sharedinternal/fsnameso the limit is defined once.Tests
internal/fsnamecovers the long-unicode case, mid-rune truncation, the suffix budget against the real 255-byte limit, and that short names pass through unchanged. Full suite passes.🤖 Generated with Claude Code