From 54603646aba5457e6558fa713f88b72ff3275a01 Mon Sep 17 00:00:00 2001 From: biast12 <53872542+biast12@users.noreply.github.com> Date: Thu, 27 Aug 2026 13:14:32 +0200 Subject: [PATCH] Allow optional inputs to keep min length Updates form component building so `MinLength` is still passed through for non-required fields, even when the value is `0`. This fixes optional inputs that need explicit length constraints while remaining optional. --- bot/button/handlers/panel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/button/handlers/panel.go b/bot/button/handlers/panel.go index 75431c54..8957b1ab 100644 --- a/bot/button/handlers/panel.go +++ b/bot/button/handlers/panel.go @@ -118,7 +118,7 @@ func buildFormComponents(inputs []database.FormInput, inputOptions map[int][]dat for i, input := range inputs { var minLength, maxLength *int var minLength32, maxLength32 *uint32 - if input.MinLength != nil && *input.MinLength > 0 { + if input.MinLength != nil && (*input.MinLength > 0 || !input.Required) { minLength = utils.Ptr(int(*input.MinLength)) minLength32 = utils.Ptr(uint32(*input.MinLength)) }