User configured working_path for tempfiles loaded from external S3 storage before processing

This commit is contained in:
2018-04-18 19:22:26 +02:00
parent 7a512722e8
commit ebbb206537
+1 -1
View File
@@ -48,7 +48,7 @@ module Dunlop::SourceFileModel
def unzip_working_file
source_path = if original_file.try(:options).try(:[], :storage) == :s3
filename = original_file.original_filename.to_s
temp = Tempfile.new([filename, File.extname(filename)]) # keep reference for tempfile till unzip completed and keep extension preserved
temp = Tempfile.new([filename, File.extname(filename)], Rails.application.config.working_path) # keep reference for tempfile till unzip completed and keep extension preserved
temp.binmode
open( original_file.expiring_url ) { |data| temp.write data.read }
temp.close