Skip to content

Commit 91bb829

Browse files
committed
do not fail on square images
1 parent 247570e commit 91bb829

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/files/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def upload( # noqa: C901,PLR0913
9090
from images.models import Image as Model # noqa: PLC0415
9191

9292
data["aspect_ratio"] = Fraction(data["width"], data["height"])
93+
if data["aspect_ratio"] == "1":
94+
data["aspect_ratio"] = "1/1"
9395
elif data["mimetype"] in settings.ALLOWED_VIDEO_TYPES:
9496
from videos.models import Video as Model # noqa: PLC0415
9597
elif data["mimetype"] in settings.ALLOWED_AUDIO_TYPES:

0 commit comments

Comments
 (0)