Fix audio not being downloaded from remote servers (#11145)

signup-info-prompt
Eugen Rochko 2019-06-22 02:50:36 +02:00 committed by GitHub
parent 84f945d64c
commit aa9b37822b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -370,7 +370,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
end end
def unsupported_media_type?(mime_type) def unsupported_media_type?(mime_type)
mime_type.present? && !(MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES).include?(mime_type) mime_type.present? && !MediaAttachment.supported_mime_types.include?(mime_type)
end end
def supported_blurhash?(blurhash) def supported_blurhash?(blurhash)

View File

@ -177,6 +177,14 @@ class MediaAttachment < ApplicationRecord
before_save :set_meta before_save :set_meta
class << self class << self
def supported_mime_types
IMAGE_MIME_TYPES + VIDEO_MIME_TYPES + AUDIO_MIME_TYPES
end
def supported_file_extensions
IMAGE_FILE_EXTENSIONS + VIDEO_FILE_EXTENSIONS + AUDIO_FILE_EXTENSIONS
end
private private
def file_styles(f) def file_styles(f)

View File

@ -60,7 +60,7 @@ class InitialStateSerializer < ActiveModel::Serializer
end end
def media_attachments def media_attachments
{ accept_content_types: MediaAttachment::IMAGE_FILE_EXTENSIONS + MediaAttachment::VIDEO_FILE_EXTENSIONS + MediaAttachment::AUDIO_FILE_EXTENSIONS + MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES + MediaAttachment::AUDIO_MIME_TYPES } { accept_content_types: MediaAttachment.supported_file_extensions + MediaAttachment.supported_mime_types }
end end
private private