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)
This commit is contained in:
parent
c2bdfb6a34
commit
9443aba06c
1 changed files with 1 additions and 1 deletions
|
|
@ -675,7 +675,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
def render("attachment_meta.json", %{
|
def render("attachment_meta.json", %{
|
||||||
attachment: %{"url" => [%{"width" => width, "height" => height} | _]}
|
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: %{
|
original: %{
|
||||||
width: width,
|
width: width,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue