Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7047 +/- ##
==========================================
- Coverage 77.42% 77.41% -0.02%
==========================================
Files 163 163
Lines 21870 21882 +12
Branches 3374 3377 +3
==========================================
+ Hits 16933 16939 +6
- Misses 4120 4124 +4
- Partials 817 819 +2
🚀 New features to boost your workflow:
|
Contributor
|
Hi! Thanks for your interest in our project. Please note our AI_POLICY! A few thoughts:
|
Review: a broad except (ValueError, OSError, MutagenError) could hide unrelated write failures. Filter JPEG/PNG by sniffed MIME before restore so illegal covers are dropped without swallowing other errors.
MwC-Trexx
force-pushed
the
fix/scrub-illegal-mp4-art
branch
from
September 23, 2026 10:49
f5213f7 to
4ab8b07
Compare
This branch has not been deployed
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.
Bug Description
Fixes #2498
scrubextracts embedded album art, strips tags, then writes the art back. For MP4/M4A files whose cover is not JPEG or PNG, mediafile can read the image but raisesValueError: MP4 files only supports PNG and JPEG imageson restore. That exception was uncaught, so a single bad cover aborted the entire import.Reproduced on beets 2.14.1 during a quiet bulk import of a large library (same traceback as #2498 / #2713).
Root Cause
beetsplug/scrub.py_scrub_itemonly caughtmediafile.UnreadableFileErroraroundmf.images = images.mediafile.storage.mp4.MP4ImageStorageStyle.serializeraisesValueErrorfor any other MIME type.Fix
Catch
ValueError,OSError, andmutagen.MutagenErroron art restore, log the path, and continue without art. Tags are still rewritten.How to Verify
covratom.beet import/beet scrubwithscrub.autoenabled.Test Plan
test_illegal_mp4_art_does_not_crash_restore(embeds TIFF intomin.m4a, asserts_scrub_itemdoes not raise)scrub.pywith the originalValueErrorpytest test/plugins/test_scrub.py— 4 passedRisk Assessment
Low — only the art-restore failure path changes; successful JPEG/PNG restore is unchanged. Worst case for illegal art is the previous implicit outcome (no art) without taking down the import.