@behaviour Pleroma.Upload.Filter
@spec filter(Pleroma.Upload.t()) :: {:ok, any()} | {:error, String.t()}
+
+ # webp is not compatible with exiftool at this time
+ def filter(%Pleroma.Upload{content_type: "image/webp"}), do: {:ok, :noop}
+
def filter(%Pleroma.Upload{name: file, tempfile: path, content_type: "image" <> _}) do
- # webp is not compatible with exiftool at this time
if Regex.match?(~r/\.(webp)$/i, file) do
{:ok, :noop}
else
test "verify webp files are skipped" do
upload = %Pleroma.Upload{
name: "sample.webp",
- content_type: "image/webp",
- path: Path.absname("/dev/null"),
- tempfile: Path.absname("/dev/null")
+ content_type: "image/webp"
+ }
+
+ bad_type = %Pleroma.Upload{
+ name: "sample.webp",
+ content_type: "image/jpeg"
}
assert Filter.Exiftool.filter(upload) == {:ok, :noop}
+ assert Filter.Exiftool.filter(bad_type) == {:ok, :noop}
end
end