From: Tom Hughes Date: Wed, 3 Jun 2020 16:47:35 +0000 (+0100) Subject: Fix new rubocop warnings X-Git-Tag: live~2096 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/c9f9ade96fef0e058704bd8583eb44dddff9965e Fix new rubocop warnings --- diff --git a/app/controllers/api/amf_controller.rb b/app/controllers/api/amf_controller.rb index db8982d43..c05a13098 100644 --- a/app/controllers/api/amf_controller.rb +++ b/app/controllers/api/amf_controller.rb @@ -868,7 +868,7 @@ module Api # not just the id, hence this abstraction def getuser(token) - if token =~ /^(.+)\:(.+)$/ + if token =~ /^(.+):(.+)$/ User.authenticate(:username => Regexp.last_match(1), :password => Regexp.last_match(2)) else User.authenticate(:token => token) diff --git a/app/helpers/browse_tags_helper.rb b/app/helpers/browse_tags_helper.rb index 4f73eb9d7..fc25325a4 100644 --- a/app/helpers/browse_tags_helper.rb +++ b/app/helpers/browse_tags_helper.rb @@ -155,7 +155,7 @@ module BrowseTagsHelper # # Also accepting / as a visual separator although not given in RFC 3966, # because it is used as a visual separator in OSM data in some countries. - if value.match?(%r{^\s*\+[\d\s\(\)/\.-]{6,25}\s*(;\s*\+[\d\s\(\)/\.-]{6,25}\s*)*$}) + if value.match?(%r{^\s*\+[\d\s()/.-]{6,25}\s*(;\s*\+[\d\s()/.-]{6,25}\s*)*$}) return value.split(";").map do |phone_number| # for display, remove leading and trailing whitespace phone_number = phone_number.strip