diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index d913e7372a7..e4a974f9683 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -25,6 +25,9 @@ class MediaAttachment < ApplicationRecord enum type: [:image, :gifv, :video, :unknown] + IMAGE_FILE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif'].freeze + VIDEO_FILE_EXTENSIONS = ['.webm', '.mp4', '.m4v'].freeze + IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze VIDEO_MIME_TYPES = ['video/webm', 'video/mp4'].freeze diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb index 9ee9bd29c82..88bbc0dff3c 100644 --- a/app/serializers/initial_state_serializer.rb +++ b/app/serializers/initial_state_serializer.rb @@ -46,6 +46,6 @@ class InitialStateSerializer < ActiveModel::Serializer end def media_attachments - { accept_content_types: MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES } + { accept_content_types: MediaAttachment::IMAGE_FILE_EXTENSIONS + MediaAttachment::VIDEO_FILE_EXTENSIONS + MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES } end end