From 8b0c21cbf87f292557cc2949fa9c1027398e79bb Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 8 Jul 2020 17:30:04 +0000 Subject: [PATCH] avoid using rescue in its modifier form at AttachmentsController#find_container git-svn-id: http://svn.redmine.org/redmine/trunk@19863 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/attachments_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 0c76490b2..f493177ec 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -218,7 +218,12 @@ class AttachmentsController < ApplicationController end def find_container - klass = params[:object_type].to_s.singularize.classify.constantize rescue nil + klass = + begin + params[:object_type].to_s.singularize.classify.constantize + rescue + nil + end unless klass && klass.reflect_on_association(:attachments) render_404 return -- 2.39.5