0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

stripe whitespace when validating length

Dieser Commit ist enthalten in:
Angus McLeod 2019-01-22 13:11:42 +11:00
Ursprung cfb93e2adb
Commit 3a5d3a0687

Datei anzeigen

@ -229,7 +229,7 @@ class CustomWizard::Builder
value = updater.fields[field['id']]
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")
updater.errors.add(field['id'].to_s, I18n.t('wizard.field.too_short', label: label, min: min_length.to_i))
end