mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
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:
parent
9c8055d4b3
commit
a32d6b3aa4
1 changed files with 5 additions and 2 deletions
|
@ -23,8 +23,8 @@ defmodule Pleroma.Web.PleromaAPI.MascotController 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 @@ defmodule Pleroma.Web.PleromaAPI.MascotController do
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue