about summary refs log tree commit diff
path: root/app/models/media_attachment.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-06-20 10:52:36 +0200
committerGitHub <noreply@github.com>2019-06-20 10:52:36 +0200
commit8f23726918fd8ded18ce9e55e6199df87abcc7cf (patch)
tree136a343e791b418fd35354cebc00bca4aecef50f /app/models/media_attachment.rb
parent7696f77245c2302787d239da50248385b3292a5e (diff)
Fix converted media being saved with original extension and mime type (#11130)
Diffstat (limited to 'app/models/media_attachment.rb')
-rw-r--r--app/models/media_attachment.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb
index 5ca218411..ae94ce68a 100644
--- a/app/models/media_attachment.rb
+++ b/app/models/media_attachment.rb
@@ -70,12 +70,14 @@ class MediaAttachment < ApplicationRecord
   AUDIO_STYLES = {
     original: {
       format: 'ogg',
+      content_type: 'audio/ogg',
       convert_options: {},
     },
   }.freeze
 
   VIDEO_FORMAT = {
     format: 'mp4',
+    content_type: 'video/mp4',
     convert_options: {
       output: {
         'loglevel' => 'fatal',
@@ -189,11 +191,11 @@ class MediaAttachment < ApplicationRecord
       if f.file_content_type == 'image/gif'
         [:gif_transcoder, :blurhash_transcoder]
       elsif VIDEO_MIME_TYPES.include?(f.file_content_type)
-        [:video_transcoder, :blurhash_transcoder]
+        [:video_transcoder, :blurhash_transcoder, :type_corrector]
       elsif AUDIO_MIME_TYPES.include?(f.file_content_type)
-        [:transcoder]
+        [:transcoder, :type_corrector]
       else
-        [:lazy_thumbnail, :blurhash_transcoder]
+        [:lazy_thumbnail, :blurhash_transcoder, :type_corrector]
       end
     end
   end