Repository navigation
fix: map .midi to audio/midi, not to two media types joined by a space - #3227
Open
paolo-perrone wants to merge 1 commit into
Open
paolo-perrone wants to merge 1 commit into
paolo-perrone wants to merge 1 commit into
Conversation
Signed-off-by: paoloap <58889145+paoloap-py@users.noreply.github.com>
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.
typeToExtensionhas the key"audio/midi audio/x-midi", which joins two media types with a space.initinverts the table, soTypeByExtension(".midi")returns that whole string.cog predict -i f=@song.midithen fails inpkg/predict/input.gowhendataurl.Newis given it as the media type, withdataurl: invalid mediatype.This keeps one key,
"audio/midi": ".midi", soExtensionByType("audio/midi")still returns.midi. The other entries are only re-aligned bygofmt.I added two tests to
pkg/util/mime/mime_test.go: one for.midiin both directions, and one that every media type in the table, in both directions, parses withmime.ParseMediaType, so a key like this one cannot come back. I checked with a small standalone program that Go's parser rejects"audio/midi audio/x-midi"("unexpected content after media subtype") and accepts"audio/midi". I could not run the repository's Go tests locally, so CI is the first real run of them.AI assistance was used to find the bug and draft the change and tests. I reviewed every changed line.