From 43d1c29d46092130eb739959d1c80aa174077a08 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 25 Dec 2012 15:46:07 +0600 Subject: [PATCH] fix RegexpError: premature end of char-class --- app/controllers/projects/pull_requests_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index 2b0b9f309..63ce7cdc0 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -111,7 +111,8 @@ class Projects::PullRequestsController < Projects::BaseController def autocomplete_to_project items = Project.accessible_by(current_ability, :membered) | @project.ancestors - items.select! {|e| Regexp.new(params[:term].downcase).match(e.name_with_owner.downcase) && e.repo.branches.count > 0} + term = Regexp.new(Regexp.escape params[:term].downcase) + items.select! {|e| term.match(e.name_with_owner.downcase) && e.repo.branches.count > 0} render :json => json_for_autocomplete_base(items) end