Ignores in exiftool read descriptions
This commit is contained in:
parent
c69ae5f7c7
commit
410d50afe5
4 changed files with 31 additions and 1 deletions
|
@ -33,7 +33,10 @@ defp read_when_empty(current_description, _, _) when is_binary(current_descripti
|
||||||
defp read_when_empty(_, file, tag) do
|
defp read_when_empty(_, file, tag) do
|
||||||
try do
|
try do
|
||||||
{tag_content, 0} =
|
{tag_content, 0} =
|
||||||
System.cmd("exiftool", ["-b", "-s3", tag, file], stderr_to_stdout: true, parallelism: true)
|
System.cmd("exiftool", ["-b", "-s3", tag, file],
|
||||||
|
stderr_to_stdout: false,
|
||||||
|
parallelism: true
|
||||||
|
)
|
||||||
|
|
||||||
tag_content = String.trim(tag_content)
|
tag_content = String.trim(tag_content)
|
||||||
|
|
||||||
|
|
BIN
test/fixtures/image_with_imagedescription_and_caption-abstract_and_stray_data_after.png
vendored
Normal file
BIN
test/fixtures/image_with_imagedescription_and_caption-abstract_and_stray_data_after.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 820 B |
BIN
test/fixtures/image_with_stray_data_after.png
vendored
Executable file
BIN
test/fixtures/image_with_stray_data_after.png
vendored
Executable file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
|
@ -42,6 +42,33 @@ test "otherwise returns ImageDescription when present" do
|
||||||
{:ok, :filtered, uploads_after}
|
{:ok, :filtered, uploads_after}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "Ignores warnings" do
|
||||||
|
uploads = %Pleroma.Upload{
|
||||||
|
name: "image_with_imagedescription_and_caption-abstract_and_stray_data_after.png",
|
||||||
|
content_type: "image/png",
|
||||||
|
path:
|
||||||
|
Path.absname(
|
||||||
|
"test/fixtures/image_with_imagedescription_and_caption-abstract_and_stray_data_after.png"
|
||||||
|
),
|
||||||
|
tempfile:
|
||||||
|
Path.absname(
|
||||||
|
"test/fixtures/image_with_imagedescription_and_caption-abstract_and_stray_data_after.png"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
assert {:ok, :filtered, %{description: "a descriptive white pixel"}} =
|
||||||
|
Filter.Exiftool.ReadDescription.filter(uploads)
|
||||||
|
|
||||||
|
uploads = %Pleroma.Upload{
|
||||||
|
name: "image_with_stray_data_after.png",
|
||||||
|
content_type: "image/png",
|
||||||
|
path: Path.absname("test/fixtures/image_with_stray_data_after.png"),
|
||||||
|
tempfile: Path.absname("test/fixtures/image_with_stray_data_after.png")
|
||||||
|
}
|
||||||
|
|
||||||
|
assert {:ok, :filtered, %{description: nil}} = Filter.Exiftool.ReadDescription.filter(uploads)
|
||||||
|
end
|
||||||
|
|
||||||
test "otherwise returns iptc:Caption-Abstract when present" do
|
test "otherwise returns iptc:Caption-Abstract when present" do
|
||||||
upload = %Pleroma.Upload{
|
upload = %Pleroma.Upload{
|
||||||
name: "image_with_caption-abstract.jpg",
|
name: "image_with_caption-abstract.jpg",
|
||||||
|
|
Loading…
Reference in a new issue