From 5def18e5f0bb8921310de8acb908f11d3209abac Mon Sep 17 00:00:00 2001 From: mdashlw Date: Sat, 20 Jul 2024 22:04:14 -0700 Subject: [PATCH 1/2] fix(Philomena.DuplicateReports.SearchQuery): validate_required in image_changeset --- lib/philomena/duplicate_reports/search_query.ex | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/philomena/duplicate_reports/search_query.ex b/lib/philomena/duplicate_reports/search_query.ex index bc922077..23525c72 100644 --- a/lib/philomena/duplicate_reports/search_query.ex +++ b/lib/philomena/duplicate_reports/search_query.ex @@ -37,6 +37,16 @@ defmodule Philomena.DuplicateReports.SearchQuery do :image_aspect_ratio, :uploaded_image ]) + |> validate_required([ + :image_width, + :image_height, + :image_format, + :image_duration, + :image_mime_type, + :image_is_animated, + :image_aspect_ratio, + :uploaded_image + ]) |> validate_number(:image_width, greater_than: 0) |> validate_number(:image_height, greater_than: 0) |> validate_inclusion( From a9077f4bf47a6e98c40db41311dd2e5aebe3f4c0 Mon Sep 17 00:00:00 2001 From: mdashlw Date: Sun, 21 Jul 2024 18:54:01 -0700 Subject: [PATCH 2/2] fix: :uploaded_image instead of :image SearchQuery doesn't have :image so I don't think this error_tag would ever be reached --- lib/philomena_web/templates/search/reverse/index.html.slime | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/philomena_web/templates/search/reverse/index.html.slime b/lib/philomena_web/templates/search/reverse/index.html.slime index 83dd72a7..97d88686 100644 --- a/lib/philomena_web/templates/search/reverse/index.html.slime +++ b/lib/philomena_web/templates/search/reverse/index.html.slime @@ -13,7 +13,7 @@ h1 Reverse Search p Upload a file from your computer, or provide a link to the page containing the image and click Fetch. .field = file_input f, :image, class: "input js-scraper" - = error_tag f, :image + = error_tag f, :uploaded_image = error_tag f, :image_width = error_tag f, :image_height = error_tag f, :image_mime_type @@ -40,7 +40,7 @@ h1 Reverse Search = cond do - is_nil(@images) -> - + - Enum.any?(@images) -> h2 Results @@ -49,7 +49,7 @@ h1 Reverse Search th   th Image th   - + = for match <- @images do tr th