Ensured thumbnail is converted to jpg before embedding

This commit is contained in:
Kieran Eglin 2024-03-12 16:15:59 -07:00
parent 8f9d18dc71
commit b5fcb4a97f
No known key found for this signature in database
GPG key ID: 193984967FCF432D
2 changed files with 9 additions and 1 deletions

View file

@ -66,7 +66,7 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilder do
acc ++ [:write_thumbnail, convert_thumbnail: "jpg"] acc ++ [:write_thumbnail, convert_thumbnail: "jpg"]
{:embed_thumbnail, true} -> {:embed_thumbnail, true} ->
acc ++ [:embed_thumbnail] acc ++ [:embed_thumbnail, convert_thumbnail: "jpg"]
_ -> _ ->
acc acc

View file

@ -141,6 +141,14 @@ defmodule Pinchflat.Downloading.DownloadOptionBuilderTest do
assert :embed_thumbnail in res assert :embed_thumbnail in res
end end
test "convertes thumbnail to jpg when embed_thumbnail is true", %{media_item: media_item} do
media_item = update_media_profile_attribute(media_item, %{embed_thumbnail: true})
assert {:ok, res} = DownloadOptionBuilder.build(media_item)
assert {:convert_thumbnail, "jpg"} in res
end
test "doesn't include these options when not specified", %{media_item: media_item} do test "doesn't include these options when not specified", %{media_item: media_item} do
media_item = update_media_profile_attribute(media_item, %{embed_thumbnail: false, download_thumbnail: false}) media_item = update_media_profile_attribute(media_item, %{embed_thumbnail: false, download_thumbnail: false})