From: Julien Lancelot Date: Tue, 8 Apr 2014 09:45:41 +0000 (+0200) Subject: SONAR-4807 Fix api/sources WS when resource parameter is missing X-Git-Tag: 4.3~106 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c6dc1f17c379b45c127eb35a0d9d887d097aeaf5;p=sonarqube.git SONAR-4807 Fix api/sources WS when resource parameter is missing --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/sources_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/sources_controller.rb index 8daa9ab3325..772fbb04d17 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/sources_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/sources_controller.rb @@ -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)