mirror of
https://github.com/redmine/redmine.git
synced 2025-11-04 20:35:57 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user