Skip to content

Commit 17fb373

Browse files
Gargronhiyuki2578
authored andcommitted
Fix audio not being downloaded from remote servers (mastodon#11145)
1 parent 70f135e commit 17fb373

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

app/lib/activitypub/activity/create.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def name_language_map?
370370
end
371371

372372
def unsupported_media_type?(mime_type)
373-
mime_type.present? && !(MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES).include?(mime_type)
373+
mime_type.present? && !MediaAttachment.supported_mime_types.include?(mime_type)
374374
end
375375

376376
def supported_blurhash?(blurhash)

app/models/media_attachment.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ def focus
177177
before_save :set_meta
178178

179179
class << self
180+
def supported_mime_types
181+
IMAGE_MIME_TYPES + VIDEO_MIME_TYPES + AUDIO_MIME_TYPES
182+
end
183+
184+
def supported_file_extensions
185+
IMAGE_FILE_EXTENSIONS + VIDEO_FILE_EXTENSIONS + AUDIO_FILE_EXTENSIONS
186+
end
187+
180188
private
181189

182190
def file_styles(f)

app/serializers/initial_state_serializer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def accounts
6565
end
6666

6767
def media_attachments
68-
{ 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 }
68+
{ accept_content_types: MediaAttachment.supported_file_extensions + MediaAttachment.supported_mime_types }
6969
end
7070

7171
private

0 commit comments

Comments
 (0)