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

This commit is contained in:
Claire 2025-06-10 15:26:29 +02:00 committed by GitHub
parent c727701839
commit 7a7e0ba4cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 64 additions and 2 deletions

View file

@ -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