]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3754 FIX for standard fields containing comas
authorDavid Gageot <david@gageot.net>
Thu, 20 Sep 2012 15:48:04 +0000 (17:48 +0200)
committerDavid Gageot <david@gageot.net>
Thu, 20 Sep 2012 15:48:04 +0000 (17:48 +0200)
sonar-server/src/main/webapp/WEB-INF/app/models/property.rb

index 39f617657ee319281f6be8d849339f71f16d6856..23d9d2f250df1996e88bc3ce6b5e33856114983b 100644 (file)
@@ -65,8 +65,15 @@ class Property < ActiveRecord::Base
   end
 
   def self.set(key, value, resource_id=nil, user_id=nil)
-    if value.kind_of? Array
-      value = value.map { |v| v.gsub(',', '%2C') }.join(',')
+    definition = Java::OrgSonarServerUi::JRubyFacade.getInstance().propertyDefinitions.get(key)
+    if definition && definition.multi_values
+      if value.kind_of? Array
+        value = value.map { |v| v.gsub(',', '%2C') }.join(',')
+      end
+    else
+      if value.kind_of? Array
+        value = value.first
+      end
     end
 
     text_value = (value.nil? ? nil : value.to_s)