From 72e1451159206af1c335b23e0c1e5bf9ed84bc85 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Wed, 27 Mar 2019 02:15:24 +0000 Subject: Use Regexp#match? to reduce allocations of MatchData object (#28940). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@18011 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/repositories_controller.rb') diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index ff950799b..85b421e77 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -320,7 +320,7 @@ class RepositoriesController < ApplicationController @rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip @rev_to = params[:rev_to] - unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE) + unless REV_PARAM_RE.match?(@rev.to_s) && REV_PARAM_RE.match?(@rev_to.to_s) if @repository.branches.blank? raise InvalidRevisionParam end -- cgit v1.2.3