From: lain Date: Sun, 7 Jun 2020 07:19:00 +0000 (+0200) Subject: AttachmentValidator: Check if the mime type is valid. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=0365053c8dbbcae4a4883f68b7eaec263c14f656;p=akkoma AttachmentValidator: Check if the mime type is valid. --- diff --git a/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex b/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex index c4b502cb9..f53bb02be 100644 --- a/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex @@ -45,11 +45,11 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator do data |> Map.put_new("mediaType", data["mimeType"]) - if data["mediaType"] == "" do + if MIME.valid?(data["mediaType"]) do data - |> Map.put("mediaType", "application/octet-stream") else data + |> Map.put("mediaType", "application/octet-stream") end end