From 2f5229cdb6017d344b0e456e2f2cfcfe5e334030 Mon Sep 17 00:00:00 2001 From: bohung Date: Thu, 20 Oct 2022 09:55:10 +0800 Subject: [PATCH] Fix bug. --- app/controllers/admin/galleries_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/galleries_controller.rb b/app/controllers/admin/galleries_controller.rb index f040529..678d122 100644 --- a/app/controllers/admin/galleries_controller.rb +++ b/app/controllers/admin/galleries_controller.rb @@ -6,6 +6,7 @@ class Admin::GalleriesController < OrbitAdminController before_action :log_user_action layout :compute_layout find_tag = Tag.all.select{|value| value.name==I18n.t('gallery.not_show_desc')} + RackTempMiddleExist = defined?(Rack::TempfileReaper) if find_tag.length==0 module_app_id = ModuleApp.where(:key=>"gallery").first[:_id] tags = ModuleApp.where(:key=>"gallery").first.tags @@ -563,7 +564,7 @@ class Admin::GalleriesController < OrbitAdminController album_unprocess.save_var = file album_unprocess.save! ObjectSpace.undefine_finalizer(file.tempfile) - request.set_header(Rack::RACK_TEMPFILES, []) # Avoid Rack::TempfileReaper Middleware to unlink temp files automatically. + request.set_header(Rack::RACK_TEMPFILES, []) if RackTempMiddleExist # Avoid Rack::TempfileReaper Middleware to unlink temp files automatically. end image.save! end