fix(audio): honor extension case and common audio MIME aliases - #2419
Open
Mykola Biron (MykolaBiron) wants to merge 3 commits into
Open
fix(audio): honor extension case and common audio MIME aliases#2419Mykola Biron (MykolaBiron) wants to merge 3 commits into
Mykola Biron (MykolaBiron) wants to merge 3 commits into
Conversation
AudioConverter.accepts() lowercases the extension and mimetype before comparing, but convert() compared them verbatim. A file named "recording.WAV" was therefore accepted, emitted its metadata, and then silently skipped transcription. The accepted mimetype list was also missing common aliases for formats already accepted by extension: audio/wav (far more common than audio/x-wav), audio/mp3, and audio/mp4, audio/m4a, audio/x-m4a. As a result .m4a support depended entirely on the filename surviving. The alias set matches the one already used for these formats in _cu_converter.py. Both the accept lists and the format lookup are now derived from a single extension/mimetype map so they cannot drift apart, and convert() normalizes case the same way accepts() does.
Author
|
@microsoft-github-policy-service agree |
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.
AudioConverter.accepts() writes the extension in lowercase and mimetype before the actual comparison happens. However, convert() has compared them verbatim. A file named "recording.WAV" was therefore accepted, emitted its metadata, and then silently skipped transcription.
The accepted mimetype list was also missing common aliases for formats already accepted by extension: audio/wav (far more common than audio/x-wav), audio/mp3, and audio/mp4, audio/m4a, audio/x-m4a. As a result, .m4a support depended entirely on the filename surviving. The alias set matches the one already used for these formats in _cu_converter.py.
Both the accept lists and the format lookup are now derived from a single extension/mimetype map. They cannot drift apart after the fix, and convert() normalizes case the same way accepts() does.