This commit is contained in:
BoHung Chiu 2022-10-20 09:55:10 +08:00
parent 750b371737
commit 2f5229cdb6
1 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@ class Admin::GalleriesController < OrbitAdminController
before_action :log_user_action before_action :log_user_action
layout :compute_layout layout :compute_layout
find_tag = Tag.all.select{|value| value.name==I18n.t('gallery.not_show_desc')} find_tag = Tag.all.select{|value| value.name==I18n.t('gallery.not_show_desc')}
RackTempMiddleExist = defined?(Rack::TempfileReaper)
if find_tag.length==0 if find_tag.length==0
module_app_id = ModuleApp.where(:key=>"gallery").first[:_id] module_app_id = ModuleApp.where(:key=>"gallery").first[:_id]
tags = ModuleApp.where(:key=>"gallery").first.tags tags = ModuleApp.where(:key=>"gallery").first.tags
@ -563,7 +564,7 @@ class Admin::GalleriesController < OrbitAdminController
album_unprocess.save_var = file album_unprocess.save_var = file
album_unprocess.save! album_unprocess.save!
ObjectSpace.undefine_finalizer(file.tempfile) 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 end
image.save! image.save!
end end