Repository navigation
Conversation
Album.art_destination() sanitized the rendered art_filename but never
truncated it, while Item.destination() puts the same template through
util.legalize_path(), which sanitizes, appends the extension and then
truncates each component.
With a template like `art_filename: `` and a long album title, the
cover file name could exceed the filesystem limit. On Windows a 264-char
album name produced a 268-char component and copying the image failed:
OSError: [Errno 22] Invalid argument
while the tracks in the same directory were shortened correctly.
Route the album art name through util.legalize_path() as well, so both stay
consistent.
Member
|
See our AI Policy. |
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.
Album.art_destination()sanitizes the renderedart_filenamebut never truncates it.Item.destination()runs the same kind of template throughutil.legalize_path(), which sanitizes, appends the extension and truncates each component - so tracks and cover art disagree once the name gets long.Reproduction (Windows 10, CPython 3.12)
Before:
The track files for the same album are shortened correctly (
Item.destination()truncates), so the import succeeds for the tracks and then fails on the cover.Change
art_destination()now usesutil.legalize_path()instead of callingutil.sanitize_path()by hand and appending the extension itself. That is the same helperItem.destination()already uses, so both paths get identical sanitizing and truncation.Tests
Added
TestArtDestination::test_art_filename_is_truncated: setsart_filename:$album, uses a 300-char album title, asserts the resulting component fitsutil.get_max_filename_length()` and keeps its extension.pytest test/test_library.py::TestArtDestinationpytest test/test_library.pypytest test/test_files.pytest_art_filename_is_truncatedat the length assertionA changelog entry is included under Unreleased -> Bug fixes.