diff --git a/app/controllers/admin/galleries_controller.rb b/app/controllers/admin/galleries_controller.rb index 3689b35..6c00e66 100644 --- a/app/controllers/admin/galleries_controller.rb +++ b/app/controllers/admin/galleries_controller.rb @@ -498,7 +498,7 @@ class Admin::GalleriesController < OrbitAdminController def upload_process - if AlbumUnprocess.first.upload_success + if (AlbumUnprocess.first.upload_success rescue false) album_unprocess = Array(AlbumUnprocess.all) count = album_unprocess.count Thread.new do @@ -563,6 +563,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. end image.save! end @@ -572,7 +573,7 @@ class Admin::GalleriesController < OrbitAdminController def last_image_id album = Album.find(params[:albumid]) lastimage = album.album_images.last - render :json => {"last_image_id" => lastimage.id.to_s}.to_json + render :json => {"last_image_id" => (lastimage ? lastimage.id.to_s : nil)}.to_json end def new_images