mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-11 09:26:37 +08:00
Remove temp files after export-all ZIP generation [SCI-2646]
This commit is contained in:
parent
2b4ef619c2
commit
5defbdd76e
1 changed files with 7 additions and 1 deletions
|
@ -30,7 +30,10 @@ class TeamZipExport < ZipExport
|
||||||
fill_content(dir_to_zip, data, type, options)
|
fill_content(dir_to_zip, data, type, options)
|
||||||
zip!(dir_to_zip, output_file.path)
|
zip!(dir_to_zip, output_file.path)
|
||||||
self.zip_file = File.open(output_file)
|
self.zip_file = File.open(output_file)
|
||||||
generate_notification(user) if save
|
if save
|
||||||
|
FileUtils.rm_rf([dir_to_zip, output_file], secure: true)
|
||||||
|
generate_notification(user)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
handle_asynchronously :generate_exportable_zip
|
handle_asynchronously :generate_exportable_zip
|
||||||
|
@ -128,6 +131,9 @@ class TeamZipExport < ZipExport
|
||||||
file = FileUtils.touch("#{root}/#{pdf_name}").first
|
file = FileUtils.touch("#{root}/#{pdf_name}").first
|
||||||
File.open(file, 'wb') { |f| f.write(project_report_pdf) }
|
File.open(file, 'wb') { |f| f.write(project_report_pdf) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Change current dir outside tmp_dir, since tmp_dir will be deleted
|
||||||
|
Dir.chdir(File.join(Rails.root, 'tmp'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_notification(user)
|
def generate_notification(user)
|
||||||
|
|
Loading…
Reference in a new issue