X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c24c2e481cc6d27e76274ed4e32668a4690a7788..4b2d3973e82291398931d108e16eacf673e77c16:/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