Merge pull request 'StatusView: handle attachments with zero width or height' (#8026) from lambadalambda/pleroma:fix/attachment-zero-size into develop

Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8026
This commit is contained in:
lain 2026-10-27 15:00:18 +00:00
commit d54ff52691
3 changed files with 20 additions and 1 deletions

View file

@ -597,6 +597,24 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
end
describe "attachments" do
test "skips meta for zero dimensions" do
for {width, height} <- [{0, 0}, {200, 0}, {0, 100}] do
object = %{
"type" => "Image",
"url" => [
%{
"mediaType" => "image/png",
"href" => "someurl",
"width" => width,
"height" => height
}
]
}
refute Map.has_key?(StatusView.render("attachment.json", %{attachment: object}), :meta)
end
end
test "Complete Mastodon style" do
object = %{
"type" => "Image",