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
This commit is contained in:
mdashlw 2024-04-06 21:10:33 +03:00 committed by GitHub
parent 2cfde149ef
commit 3714ae115c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -187,7 +187,7 @@ defmodule Philomena.Images.Image do
height = fetch_field!(changeset, :image_height) height = fetch_field!(changeset, :image_height)
cond do cond do
width <= 0 or height <= 0 -> is_nil(width) or is_nil(height) or width <= 0 or height <= 0 ->
add_error( add_error(
changeset, changeset,
:image, :image,