From 3714ae115c0a881ce1405a7256011cd44a52faff Mon Sep 17 00:00:00 2001 From: mdashlw Date: Sat, 6 Apr 2024 21:10:33 +0300 Subject: [PATCH] fix: misleading error if image is corrupted (#222) width/height can be nil here, first case doesn't match but nil is indeed bigger than 32767, so the incorrect error message will be displayed --- lib/philomena/images/image.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/philomena/images/image.ex b/lib/philomena/images/image.ex index a6892185..d8e791c8 100644 --- a/lib/philomena/images/image.ex +++ b/lib/philomena/images/image.ex @@ -187,7 +187,7 @@ defmodule Philomena.Images.Image do height = fetch_field!(changeset, :image_height) cond do - width <= 0 or height <= 0 -> + is_nil(width) or is_nil(height) or width <= 0 or height <= 0 -> add_error( changeset, :image,