Skip to content

Commit

Permalink
Use a temporary folder
Browse files Browse the repository at this point in the history
  • Loading branch information
madeindjs committed Dec 3, 2018
1 parent 59bbef6 commit 9a2ad36
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/active_storage/send_zip.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'active_storage/send_zip/version'
require 'rails'
require 'zip'
require 'tempfile'

module ActiveStorage
module SendZip
Expand Down Expand Up @@ -29,8 +30,8 @@ def send_zip(active_storages, filename: 'my.zip')
def save_files_on_server(files)
require 'zip'
# get a temporary folder and create it
temp_folder = File.join(Dir.tmpdir, 'user')
FileUtils.mkdir_p(temp_folder) unless Dir.exist?(temp_folder)
temp_folder = Dir.mktmpdir 'active_storage-send_zip'
# FileUtils.mkdir_p(temp_folder) unless Dir.exist?(temp_folder)

# download all ActiveStorage into
files.map do |picture|
Expand Down

0 comments on commit 9a2ad36

Please sign in to comment.