From 13f9ccaed853654df5cfb990884345b513f0b88c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 8 Nov 2014 10:52:59 +0000 Subject: Adds configuration settings to limit valid repository path (#1415). git-svn-id: http://svn.redmine.org/redmine/trunk@13573 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/configuration.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/redmine') diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb index 01abf4e93..77bdd8fd0 100644 --- a/lib/redmine/configuration.rb +++ b/lib/redmine/configuration.rb @@ -58,6 +58,7 @@ module Redmine end end + check_regular_expressions @config end @@ -112,6 +113,20 @@ module Redmine @config.merge!({'email_delivery' => load_from_yaml(deprecated_email_conf, env)}) end end + + # Checks the validness of regular expressions set for repository paths at startup + def check_regular_expressions + @config.each do |name, value| + if value.present? && name =~ /^scm_.+_path_regexp$/ + begin + Regexp.new value.to_s.strip + rescue => e + $stderr.puts "Invalid regular expression set as #{name} setting in your Redmine configuration file:\n#{e.message}" + exit 1 + end + end + end + end end end end -- cgit v1.2.3