From 9443aba06ceed356fbafe869a5abb8a4ba0af510 Mon Sep 17 00:00:00 2001 From: Oneric Date: Sun, 15 Mar 2026 00:00:00 +0000 Subject: [PATCH] api/view: handle explicitly zero dimensions in attachments Some peertube videos are federated with explicitly zero dimensions for their mp4 link leading to a division-by-zero exception here. E.g.: https://spectra.video/videos/watch/66c12674-2013-47a4-9126-51ff8eb8d0a8 (as of writing using peertube 8.1.1) Reported by temp3 on IRC (cherry picked from commit 6833281051aa86b3d82232be29497fed47bf5fb1) --- lib/pleroma/web/mastodon_api/views/status_view.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 4625be47c..6a5d627a5 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -675,7 +675,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do def render("attachment_meta.json", %{ attachment: %{"url" => [%{"width" => width, "height" => height} | _]} }) - when is_integer(width) and is_integer(height) do + when is_integer(width) and is_integer(height) and width > 0 and height > 0 do %{ original: %{ width: width,