X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpleroma%2Fupload%2Ffilter%2Fmogrify.ex;h=f27aefc2252d283451006cc987d45cb541d86b92;hb=0c8da6466e9fd01b63e9224f9ac18655fd8bf86b;hp=7a45add5a2cda00662d43bd17d31b67e90797655;hpb=1298a2ea2c63f14cc080eb549377c6a1274b1628;p=akkoma
diff --git a/lib/pleroma/upload/filter/mogrify.ex b/lib/pleroma/upload/filter/mogrify.ex
index 7a45add5a..f27aefc22 100644
--- a/lib/pleroma/upload/filter/mogrify.ex
+++ b/lib/pleroma/upload/filter/mogrify.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Upload.Filter.Mogrify do
@@ -8,18 +8,18 @@ defmodule Pleroma.Upload.Filter.Mogrify do
@type conversion :: action :: String.t() | {action :: String.t(), opts :: String.t()}
@type conversions :: conversion() | [conversion()]
- @spec filter(Pleroma.Upload.t()) :: :ok | {:error, String.t()}
+ @spec filter(Pleroma.Upload.t()) :: {:ok, :atom} | {:error, String.t()}
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
try do
do_filter(file, Pleroma.Config.get!([__MODULE__, :args]))
- :ok
+ {:ok, :filtered}
rescue
- _e in ErlangError ->
- {:error, "mogrify command not found"}
+ e in ErlangError ->
+ {:error, "#{__MODULE__}: #{inspect(e)}"}
end
end
- def filter(_), do: :ok
+ def filter(_), do: {:ok, :noop}
def do_filter(file, filters) do
file