[ignore_video_file_under_size] v0.0.4: fix NoneType crash + dead extension fallback - #512
Open
funkekaiser wants to merge 1 commit into
Open
Conversation
Fix TypeError crash when mimetypes.guess_type() returns None. guess_type()
returns None for unknown extensions, and can also return None for valid
media files when racing another plugin's mimetypes.init() call on Unmanic's
concurrent file-tester threads. The crash aborted the whole file-test
runner for that file on every scan.
Also fix the known-video-extension fallback: os.path.splitext() returns
extensions with a leading dot ('.mp4'), so membership in the dot-less list
could never match, making the branch dead code.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
Testing note (per CONTRIBUTING quality control): verified against Unmanic |
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
Two bugs in
on_library_management_file_test:TypeError: argument of type 'NoneType' is not iterable—mimetypes.guess_type()returnsNonefor unknown extensions (e.g. transient.unmanic.partfiles during post-processing), and can also returnNonefor valid media files when racing another plugin'smimetypes.init()call on Unmanic's concurrent file-tester threads (see Fix thread race: only call mimetypes.init() once Josh5/unmanic.plugin.helpers.ffmpeg#7 — the vendored helper lib re-inits the global mimetypes database on everyProbe()). The crash aborts this plugin's file test for that file on every scan.Dead fallback branch —
os.path.splitext()returns extensions with a leading dot (".mp4"), so membership in the dot-less list["mkv", "mp4", ...]never matches, and the known-video-extension check is unreachable.Fix
Nonemimetype like any other non-video mimetype instead of crashing..lstrip(".").lower()) so the fallback works as intended.Version bumped to 0.0.4 with changelog entries.
🤖 Generated with Claude Code