]> cat aescling's git repositories - mastodon.git/commitdiff
Fix support for MP4 files that are actually M4V files (#11210)
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 30 Jun 2019 14:10:43 +0000 (16:10 +0200)
committerGitHub <noreply@github.com>
Sun, 30 Jun 2019 14:10:43 +0000 (16:10 +0200)
Resolve #11187

app/models/concerns/attachmentable.rb

index 24f5968de41c42f05892a946d5029ae7b317e7bd..7c78bb45698dccf8e9036cc3e2eb53272ee2ba43 100644 (file)
@@ -60,7 +60,9 @@ module Attachmentable
   end
 
   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
     ''
   end