summaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-01-20 03:31:41 +0000
committerGo MAEDA <maeda@farend.jp>2023-01-20 03:31:41 +0000
commit9d65eee4248acef921d102f1e614618514afcd51 (patch)
tree46bb18bdb4bcb47f399b9c27019e2fa46e6b33fa /app/controllers/application_controller.rb
parent21eef7e65c5972cd65c183bf17e261fa67e34867 (diff)
downloadredmine-9d65eee4248acef921d102f1e614618514afcd51.tar.gz
redmine-9d65eee4248acef921d102f1e614618514afcd51.zip
Avoid double-render error with ApplicationController#find_optional_project (#38063).
Patch by Holger Just. git-svn-id: https://svn.redmine.org/redmine/trunk@22066 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 6bda01088..c39fe8ad1 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -354,9 +354,12 @@ class ApplicationController < ActionController::Base
# and authorize the user for the requested action
def find_optional_project
if params[:project_id].present?
- find_project(params[:project_id])
+ @project = Project.find(params[:project_id])
end
authorize_global
+ rescue ActiveRecord::RecordNotFound
+ User.current.logged? ? render_404 : require_login
+ false
end
# Finds and sets @project based on @object.project