From e41ed396d6645c44252b3cfaa70c8d3920bf0ea4 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 4 Jun 2013 16:29:55 +0200 Subject: [PATCH] Replace all space by '_' in key when creating manual rule --- sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb index 7b425f0cbe4..a8bd6d19d37 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb @@ -181,7 +181,7 @@ class Rule < ActiveRecord::Base if Api::Utils.is_integer?(rule_id_or_name) rule = Rule.first(:conditions => {:status => STATUS_READY, :plugin_name => MANUAL_REPOSITORY_KEY, :id => rule_id_or_name.to_i}) else - key = rule_id_or_name.strip.downcase.sub(/\s+/, '_') + key = rule_id_or_name.strip.downcase.gsub(/\s/, '_') rule = Rule.first(:conditions => {:status => STATUS_READY, :plugin_name => MANUAL_REPOSITORY_KEY, :plugin_rule_key => key}) if rule==nil && create_if_not_found description = options[:description] || Api::Utils.message('manual_rules.should_provide_real_description') -- 2.39.5