Add startup check to ensure we can convert the heic files
This commit is contained in:
parent
d265c2c0f1
commit
13b57f2cb3
@ -162,7 +162,8 @@ defmodule Pleroma.ApplicationRequirements do
|
||||
filter_commands_statuses = [
|
||||
check_filter(Pleroma.Upload.Filters.Exiftool, "exiftool"),
|
||||
check_filter(Pleroma.Upload.Filters.Mogrify, "mogrify"),
|
||||
check_filter(Pleroma.Upload.Filters.Mogrifun, "mogrify")
|
||||
check_filter(Pleroma.Upload.Filters.Mogrifun, "mogrify"),
|
||||
check_filter(Pleroma.Upload.Filters.HeifToJpeg, "mogrify")
|
||||
]
|
||||
|
||||
preview_proxy_commands_status =
|
||||
@ -213,6 +214,31 @@ defmodule Pleroma.ApplicationRequirements do
|
||||
|
||||
defp check_repo_pool_size!(result), do: result
|
||||
|
||||
defp check_filter(:"Elixir.Pleroma.Upload.Filter.HeifToJpeg" = filter, command_required) do
|
||||
filters = Config.get([Pleroma.Upload, :filters])
|
||||
|
||||
if filter in filters && Pleroma.Utils.command_available?(command_required) do
|
||||
output =
|
||||
String.to_charlist("#{command_required} --version")
|
||||
|> :os.cmd()
|
||||
|> String.Chars.to_string()
|
||||
|> String.split()
|
||||
|
||||
cond do
|
||||
"heic" in output ->
|
||||
true
|
||||
|
||||
true ->
|
||||
Logger.error(
|
||||
"#{filter} is specified in the list of Pleroma.Upload filters, but the " <>
|
||||
"#{command_required} does not support heic files."
|
||||
)
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
defp check_filter(filter, command_required) do
|
||||
filters = Config.get([Pleroma.Upload, :filters])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user