Defect #43521 » cf-regexp-error.patch
| lib/redmine/field_format.rb | ||
|---|---|---|
|
def validate_single_value(custom_field, value, customized=nil)
|
||
|
errs = super
|
||
|
value = value.to_s
|
||
|
unless custom_field.regexp.blank? or Regexp.new(custom_field.regexp).match?(value)
|
||
|
errs << ::I18n.t('activerecord.errors.messages.invalid')
|
||
|
if custom_field.regexp.present?
|
||
|
begin
|
||
|
unless Regexp.new(custom_field.regexp).match?(value)
|
||
|
errs << ::I18n.t('activerecord.errors.messages.invalid')
|
||
|
end
|
||
|
rescue RegexpError
|
||
|
# The invalid regexp is validated in CustomField#validate_custom_field,
|
||
|
# so we can skip validation here
|
||
|
end
|
||
|
end
|
||
|
if custom_field.min_length && value.length < custom_field.min_length
|
||
|
errs << ::I18n.t('activerecord.errors.messages.too_short', :count => custom_field.min_length)
|
||