Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-29 12:20:27 +01:00
stripe whitespace when validating length
Dieser Commit ist enthalten in:
Ursprung
cfb93e2adb
Commit
3a5d3a0687
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
|
@ -229,7 +229,7 @@ class CustomWizard::Builder
|
||||||
value = updater.fields[field['id']]
|
value = updater.fields[field['id']]
|
||||||
min_length = field['min_length']
|
min_length = field['min_length']
|
||||||
|
|
||||||
if min_length && value.is_a?(String) && value.length < min_length.to_i
|
if min_length && value.is_a?(String) && value.strip.length < min_length.to_i
|
||||||
label = field['label'] || I18n.t("#{field['key']}.label")
|
label = field['label'] || I18n.t("#{field['key']}.label")
|
||||||
updater.errors.add(field['id'].to_s, I18n.t('wizard.field.too_short', label: label, min: min_length.to_i))
|
updater.errors.add(field['id'].to_s, I18n.t('wizard.field.too_short', label: label, min: min_length.to_i))
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren