Adds configuration settings to limit valid repository path (#1415).

git-svn-id: http://svn.redmine.org/redmine/trunk@13573 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2014-11-08 10:52:59 +00:00
parent 34bb545e4f
commit 13f9ccaed8
9 changed files with 145 additions and 9 deletions

View File

@@ -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