X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/77f9aec772eb4bb1a413e310dd30a8532dccab5c..843635e1b3b5e200da5099e8a1ec3d805676bcb9:/app/validators/characters_validator.rb diff --git a/app/validators/characters_validator.rb b/app/validators/characters_validator.rb index ee5b5bcf3..94d340731 100644 --- a/app/validators/characters_validator.rb +++ b/app/validators/characters_validator.rb @@ -4,9 +4,6 @@ class CharactersValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors[attribute] << (options[:message] || I18n.t("validations.invalid_characters")) if /[#{INVALID_CHARS}]/.match?(value) - - if options[:url_safe] - record.errors[attribute] << (options[:message] || I18n.t("validations.url_characters", :characters => INVALID_URL_CHARS)) if /[#{INVALID_URL_CHARS}]/.match?(value) - end + record.errors[attribute] << (options[:message] || I18n.t("validations.url_characters", :characters => INVALID_URL_CHARS)) if options[:url_safe] && /[#{INVALID_URL_CHARS}]/.match?(value) end end