Check if mogrify available before calling it
This commit is contained in:
parent
523f1b93a4
commit
3116a75e80
@ -35,9 +35,12 @@ defmodule Pleroma.Upload.Filter.Mogrifun do
|
||||
]
|
||||
|
||||
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
||||
Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
|
||||
|
||||
:ok
|
||||
if Pleroma.Utils.command_available?("mogrify") do
|
||||
Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
|
||||
:ok
|
||||
else
|
||||
{:error, "mogrify command not found"}
|
||||
end
|
||||
end
|
||||
|
||||
def filter(_), do: :ok
|
||||
|
@ -9,10 +9,14 @@ defmodule Pleroma.Upload.Filter.Mogrify do
|
||||
@type conversions :: conversion() | [conversion()]
|
||||
|
||||
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
||||
filters = Pleroma.Config.get!([__MODULE__, :args])
|
||||
if Pleroma.Utils.command_available?("mogrify") do
|
||||
filters = Pleroma.Config.get!([__MODULE__, :args])
|
||||
|
||||
do_filter(file, filters)
|
||||
:ok
|
||||
do_filter(file, filters)
|
||||
:ok
|
||||
else
|
||||
{:error, "mogrify command not found"}
|
||||
end
|
||||
end
|
||||
|
||||
def filter(_), do: :ok
|
||||
|
Loading…
Reference in New Issue
Block a user