Merge branch 'fix/filters' into 'develop'

Minor fixes to upload filters

See merge request pleroma/pleroma!3332
This commit is contained in:
Haelwenn 2021-02-20 21:18:04 +00:00
commit f6d43cec42
4 changed files with 9 additions and 7 deletions

View File

@ -59,6 +59,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Ability to define custom HTTP headers per each frontend - Ability to define custom HTTP headers per each frontend
- MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users - MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users
- New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required) - New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required)
- Added Pleroma.Upload.Filter.HeifToJpeg to automate converting .heic files from Apple devices to JPEGs which can be viewed in browsers. Requires heic-convert tool from libheif.
<details> <details>
<summary>API Changes</summary> <summary>API Changes</summary>

View File

@ -11,7 +11,8 @@ defmodule Pleroma.Upload.Filter.Exiftool do
@spec filter(Pleroma.Upload.t()) :: {:ok, any()} | {:error, String.t()} @spec filter(Pleroma.Upload.t()) :: {:ok, any()} | {:error, String.t()}
# webp is not compatible with exiftool at this time # Formats not compatible with exiftool at this time
def filter(%Pleroma.Upload{content_type: "image/heic"}), do: {:ok, :noop}
def filter(%Pleroma.Upload{content_type: "image/webp"}), do: {:ok, :noop} def filter(%Pleroma.Upload{content_type: "image/webp"}), do: {:ok, :noop}
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
@ -21,8 +22,8 @@ defmodule Pleroma.Upload.Filter.Exiftool do
{error, 1} -> {:error, error} {error, 1} -> {:error, error}
end end
rescue rescue
_e in ErlangError -> e in ErlangError ->
{:error, "exiftool command not found"} {:error, "#{__MODULE__}: #{inspect(e)}"}
end end
end end

View File

@ -44,8 +44,8 @@ defmodule Pleroma.Upload.Filter.Mogrifun do
Filter.Mogrify.do_filter(file, [Enum.random(@filters)]) Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
{:ok, :filtered} {:ok, :filtered}
rescue rescue
_e in ErlangError -> e in ErlangError ->
{:error, "mogrify command not found"} {:error, "#{__MODULE__}: #{inspect(e)}"}
end end
end end

View File

@ -14,8 +14,8 @@ defmodule Pleroma.Upload.Filter.Mogrify do
do_filter(file, Pleroma.Config.get!([__MODULE__, :args])) do_filter(file, Pleroma.Config.get!([__MODULE__, :args]))
{:ok, :filtered} {:ok, :filtered}
rescue rescue
_e in ErlangError -> e in ErlangError ->
{:error, "mogrify command not found"} {:error, "#{__MODULE__}: #{inspect(e)}"}
end end
end end