Pleroma.Web.PleromaAPI.MascotController: dialyzer error

lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:33:pattern_match
The pattern can never match the type.

Pattern:
{:content_type, _}

Type:
{:error, _}
This commit is contained in:
Mark Felder 2024-01-28 12:35:45 -05:00
parent 9c8055d4b3
commit a32d6b3aa4
1 changed files with 5 additions and 2 deletions

View File

@ -23,8 +23,8 @@ def show(%{assigns: %{user: user}} = conn, _params) do
@doc "PUT /api/v1/pleroma/mascot"
def update(%{assigns: %{user: user}, body_params: %{"file" => file}} = conn, _) do
with {:content_type, "image" <> _} <- {:content_type, file.content_type},
{:ok, object} <- ActivityPub.upload(file, actor: User.ap_id(user)) do
with {_, "image" <> _} <- {:content_type, file.content_type},
{_, {:ok, object}} <- {:upload, ActivityPub.upload(file, actor: User.ap_id(user))} do
attachment = render_attachment(object)
{:ok, _user} = User.mascot_update(user, attachment)
@ -32,6 +32,9 @@ def update(%{assigns: %{user: user}, body_params: %{"file" => file}} = conn, _)
else
{:content_type, _} ->
render_error(conn, :unsupported_media_type, "mascots can only be images")
{:upload, {:error, _}} ->
render_error(conn, :error, "error uploading file")
end
end