Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ogg vorbis files with a cover art not being correctly processed #14255

Merged
merged 1 commit into from Jul 7, 2020

Conversation

ClearlyClaire
Copy link
Contributor

Paperclip runs files through a “spoof detector” to figure out whether they correspond to their advertised content-type.

In #14184, we have overridden part of that detection because it relied on the file utility which returns application/octet-stream for some mp3 files, and used MimeMagic instead.

However, MimeMagic detects Ogg Vorbis files with a cover art as video/ogg, while file correctly detects it as audio/ogg. This causes a mismatch when the file has an .oga extension, which is explicitly audio/ogg.

Furthermore, this leads to Ogg Vorbis files submitted with the .ogg and a cover art to not be correctly processed, failing to extract a thumbnail and converting them to .mp3. This is because the first validation passes interpreting it as a video/ogg file while our code later constructs a .oga extension based on the correctly detected audio/ogg, causing the actual processing to be skipped because of the mismatch.

This PR changes the detector to allow the validation to pass if it matches either FileMagic or file's output.

@Gargron Gargron merged commit 701e5b9 into mastodon:master Jul 7, 2020
shouo1987 pushed a commit to CrossGate-Pawoo/mastodon that referenced this pull request Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants