]> source.dussan.org Git - redmine.git/commitdiff
avoid using rescue in its modifier form at AttachmentsController#find_container
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 8 Jul 2020 17:30:04 +0000 (17:30 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 8 Jul 2020 17:30:04 +0000 (17:30 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@19863 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/attachments_controller.rb

index 0c76490b2aea916394a77c48068655a5578e7f41..f493177eca24624fdb55d55d856b2c76232b8aae 100644 (file)
@@ -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