diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-11-08 10:52:59 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-11-08 10:52:59 +0000 |
commit | 13f9ccaed853654df5cfb990884345b513f0b88c (patch) | |
tree | 7e7bc0be36a46b5e87032e89862f56894f68f422 /lib | |
parent | 34bb545e4f327d24bd81a0bdb4ec02c6fb6ee0e7 (diff) | |
download | redmine-13f9ccaed853654df5cfb990884345b513f0b88c.tar.gz redmine-13f9ccaed853654df5cfb990884345b513f0b88c.zip |
Adds configuration settings to limit valid repository path (#1415).
git-svn-id: http://svn.redmine.org/redmine/trunk@13573 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/configuration.rb | 15 |
1 files changed, 15 insertions, 0 deletions
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 |