Add basic support for remote attachments with multiple media types (#34996)

This commit is contained in:
Claire authored and GitHub committed 2025-06-10 13:26:29 +00:00
1 parent c727701839
commit 7a7e0ba4cd
3 files changed
+64 -2

No files matched your search

@@ -15,7 +15,7 @@ class ActivityPub::Parser::MediaAttachmentParser
end
def remote_url
url = Addressable::URI.parse(@json['url'])&.normalize&.to_s
url = Addressable::URI.parse(url_to_href(@json['url']))&.normalize&.to_s
url unless unsupported_uri_scheme?(url)
rescue Addressable::URI::InvalidURIError
nil
@@ -43,7 +43,7 @@ class ActivityPub::Parser::MediaAttachmentParser
end
def file_content_type
@json['mediaType']
@json['mediaType'] || url_to_media_type(@json['url'])
end
private