Add basic support for remote attachments with multiple media types (#34996)
This commit is contained in:
parent
c727701839
commit
7a7e0ba4cd
3 changed files with 64 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue