Skip to content

Commit

Permalink
fix: misleading error if image is corrupted (#222)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mdashlw authored Apr 6, 2024
1 parent 2cfde14 commit 3714ae1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/philomena/images/image.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3714ae1

Please sign in to comment.