]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4807 Fix api/sources WS when resource parameter is missing
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 8 Apr 2014 09:45:41 +0000 (11:45 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 8 Apr 2014 09:45:41 +0000 (11:45 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/api/sources_controller.rb

index 8daa9ab33255675fa7bbf484d8e7b1122782e2ce..772fbb04d17cd5214d5858406d14d67273d31aae 100644 (file)
@@ -23,6 +23,11 @@ require "json"
 class Api::SourcesController < Api::RestController
 
   def rest_call
+    unless params[:resource]
+      rest_status_ko('Missing parameter: resource', 400)
+      return
+    end
+
     resource_id=params[:resource]
     if resource_id
       @resource=Project.by_key(resource_id)