From 5b0399229fd4d0cf361668d6832279d33ef27449 Mon Sep 17 00:00:00 2001 From: Mark Dumay Date: Mon, 5 Feb 2024 10:19:24 +0100 Subject: [PATCH] fix: improve handling of partial ranges --- layouts/partials/utilities/IsInvalidArgs.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/layouts/partials/utilities/IsInvalidArgs.html b/layouts/partials/utilities/IsInvalidArgs.html index e7aa9a2..6246ad4 100644 --- a/layouts/partials/utilities/IsInvalidArgs.html +++ b/layouts/partials/utilities/IsInvalidArgs.html @@ -103,8 +103,13 @@ {{ $error = true }} {{ end }} {{ else if and (or $def.options.min $def.options.max) (in (slice "int" "float" "float64") $actual) }} - {{ if or (lt $val $def.options.min) (gt $val $def.options.max) }} - {{ warnf "[%s] argument '%s': value '%s' out of range [%d, %d]" $structure (string $key) (string $val) $def.options.min $def.options.max}} + {{ if or + (and $def.options.min (lt $val $def.options.min)) + (and $def.options.max (gt $val $def.options.max)) + }} + {{ $min := (string (or $def.options.min "-")) }} + {{ $max := (string (or $def.options.max "-")) }} + {{ warnf "[%s] argument '%s': value '%s' out of range [%s, %s]" $structure (string $key) (string $val) $min $max }} {{ $error = true }} {{ end }} {{ end }}