summaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-07-31 16:24:26 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-07-31 16:24:36 +0200
commitb7a5a57385b12b10ef01db2127764fa834cfcc06 (patch)
tree7082327fc86b73f897e910b44a2abdb9fb8db126 /server/sonar-web
parentb392394253933286c7c234a459df6ad1cef53f02 (diff)
downloadsonarqube-b7a5a57385b12b10ef01db2127764fa834cfcc06.tar.gz
sonarqube-b7a5a57385b12b10ef01db2127764fa834cfcc06.zip
SONAR-5332 Redirect to home when drilling down on unexisting project
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/application_controller.rb12
1 files changed, 8 insertions, 4 deletions
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