Skip to content

Commit

Permalink
Fix audio not being downloaded from remote servers (mastodon#11145)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent 70f135e commit 17fb373
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/lib/activitypub/activity/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def name_language_map?
end

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

def supported_blurhash?(blurhash)
Expand Down
8 changes: 8 additions & 0 deletions app/models/media_attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ def focus
before_save :set_meta

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

def file_styles(f)
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/initial_state_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def accounts
end

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

private
Expand Down

0 comments on commit 17fb373

Please sign in to comment.