transmogrifier: MIME.valid?/1 for mediaType

No issues with the rest of the network yet but this makes sure it will work
once https://git.pleroma.social/pleroma/pleroma/-/merge_requests/2429
is merged.
This commit is contained in:
Haelwenn (lanodan) Monnier 2020-06-08 21:04:16 +02:00
parent d192492658
commit fe1cb56fdc
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
1 changed files with 3 additions and 3 deletions

View File

@ -221,9 +221,9 @@ def fix_attachments(%{"attachment" => attachment} = object) when is_list(attachm
media_type = media_type =
cond do cond do
is_map(url) && is_binary(url["mediaType"]) -> url["mediaType"] is_map(url) && MIME.valid?(url["mediaType"]) -> url["mediaType"]
is_binary(data["mediaType"]) -> data["mediaType"] MIME.valid?(data["mediaType"]) -> data["mediaType"]
is_binary(data["mimeType"]) -> data["mimeType"] MIME.valid?(data["mimeType"]) -> data["mimeType"]
true -> nil true -> nil
end end