Uh oh!
There was an error while loading. Please reload this page.
fix: file()/video() forward computed MIME (#3) - #9
Merged
Conversation
file()/video() computed the MIME only for the blacklist check and set format only when the caller passed one. For an https-URL file/video part with no explicit format, the server had no data-URL MIME to read and fell back to application/octet-stream, undercutting file/video support. Forward the computed MIME as format (the server uses file.format verbatim as mediaType). video() and auto_part inherit this via file(). Unknown extensions still yield no format, preserving the octet-stream fallback.
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 freeto 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.
Fixes#3
Problem
file()/video()computed the MIME but used it only for the blacklist check —formatwas added to the part only when the caller passed one explicitly. For an https-URLfile/videopart with no format, the server has no data-URL MIME to extract and falls back to:So
video("https://…/clip.mp4")reached model selection asapplication/octet-stream.Fix
Forward the computed MIME as
format(the server usesfile.formatverbatim asmediaType, so the full type likevideo/mp4is correct — this is the opposite ofinput_audio.format, which getsaudio/prepended).video()andauto_partinherit the fix throughfile().Unknown-extension URLs still resolve to no MIME → no
formatkey → the sameapplication/octet-streamfallback as today (no regression).Tests
Added:
file()forwardsapplication/pdf,video()forwardsvideo/mp4,auto_partmp4 →video/mp4, and unknown-ext omitsformat. Suite: 27 passing;ruff+mypy --strictclean.Note
The
_inputs.pydiff also carries the repo formatter's_EXT_MIMEnormalization (same as #7).