1
0
Fork 0
forked from fedi/mastodon

Fix support for MP4 files that are actually M4V files (#11210)

Resolve #11187
This commit is contained in:
Eugen Rochko 2019-06-30 16:10:43 +02:00 committed by GitHub
parent f895bf1984
commit 06424786a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,7 +60,9 @@ module Attachmentable
end end
def calculated_content_type(attachment) def calculated_content_type(attachment)
Paperclip.run('file', '-b --mime :file', file: attachment.queued_for_write[:original].path).split(/[:;\s]+/).first.chomp content_type = Paperclip.run('file', '-b --mime :file', file: attachment.queued_for_write[:original].path).split(/[:;\s]+/).first.chomp
content_type = 'video/mp4' if content_type == 'video/x-m4v'
content_type
rescue Terrapin::CommandLineError rescue Terrapin::CommandLineError
'' ''
end end