Merge branch '2768-strip-location' into 'develop'
Resolve "Exiftool may conflict with SVG files" Closes #2768 See merge request pleroma/pleroma!3829
This commit is contained in:
commit
2a244b391d
@ -14,6 +14,7 @@ defmodule Pleroma.Upload.Filter.Exiftool.StripLocation do
|
|||||||
# Formats 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/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{content_type: "image/svg" <> _}), do: {:ok, :noop}
|
||||||
|
|
||||||
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
||||||
try do
|
try do
|
||||||
|
@ -31,12 +31,19 @@ defmodule Pleroma.Upload.Filter.Exiftool.StripLocationTest do
|
|||||||
refute String.match?(exif_filtered, ~r/GPS/)
|
refute String.match?(exif_filtered, ~r/GPS/)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "verify webp files are skipped" do
|
test "verify webp, heic, svg files are skipped" do
|
||||||
upload = %Pleroma.Upload{
|
uploads =
|
||||||
name: "sample.webp",
|
~w{webp heic svg svg+xml}
|
||||||
content_type: "image/webp"
|
|> Enum.map(fn type ->
|
||||||
}
|
%Pleroma.Upload{
|
||||||
|
name: "sample.#{type}",
|
||||||
|
content_type: "image/#{type}"
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
|
||||||
assert Filter.Exiftool.StripLocation.filter(upload) == {:ok, :noop}
|
uploads
|
||||||
|
|> Enum.each(fn upload ->
|
||||||
|
assert Filter.Exiftool.StripLocation.filter(upload) == {:ok, :noop}
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user