From 567eaac69725144d4f5b8d1eac759b8ef1572298 Mon Sep 17 00:00:00 2001 From: mdashlw Date: Mon, 10 Jun 2024 17:48:29 +0300 Subject: [PATCH] image: validate sources length --- lib/philomena/images/image.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/philomena/images/image.ex b/lib/philomena/images/image.ex index d8e791c8..7b808eaa 100644 --- a/lib/philomena/images/image.ex +++ b/lib/philomena/images/image.ex @@ -212,11 +212,13 @@ defmodule Philomena.Images.Image do image |> cast(attrs, []) |> SourceDiffer.diff_input(old_sources, new_sources) + |> validate_length(:sources, max: 15) end def sources_changeset(image, new_sources) do change(image) |> put_assoc(:sources, new_sources) + |> validate_length(:sources, max: 15) end def tag_changeset(image, attrs, old_tags, new_tags, excluded_tags \\ []) do