From: Jean-Baptiste Lievremont Date: Thu, 31 Jul 2014 14:24:26 +0000 (+0200) Subject: SONAR-5332 Redirect to home when drilling down on unexisting project X-Git-Tag: 4.5-RC1~313 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b7a5a57385b12b10ef01db2127764fa834cfcc06;p=sonarqube.git SONAR-5332 Redirect to home when drilling down on unexisting project --- diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb index 88267cddd00..b01a0792d25 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb @@ -257,12 +257,16 @@ class ApplicationController < ActionController::Base def init_resource_for_role(role, resource_param=:id) @resource=Project.by_key(params[resource_param]) - not_found("Project not found") unless @resource - @resource=@resource.permanent_resource + unless @resource + flash[:error] = message('dashboard.project_not_found') + redirect_to :controller => :dashboard, :action => :index + else + @resource=@resource.permanent_resource - @snapshot=@resource.last_snapshot + @snapshot=@resource.last_snapshot - access_denied unless has_role?(role, @resource) + access_denied unless has_role?(role, @resource) + end end