Ensure temp files deletion after export is done [SCI-2646]

This commit is contained in:
Matej Zrimšek 2018-11-08 21:19:17 +01:00
parent 2f6a6072e1
commit b7fdd82409
2 changed files with 6 additions and 8 deletions

View file

@ -30,10 +30,9 @@ class TeamZipExport < ZipExport
fill_content(dir_to_zip, data, type, options)
zip!(dir_to_zip, output_file.path)
self.zip_file = File.open(output_file)
if save
FileUtils.rm_rf([dir_to_zip, output_file], secure: true)
generate_notification(user)
end
generate_notification(user) if save
ensure
FileUtils.rm_rf([dir_to_zip, output_file], secure: true)
end
handle_asynchronously :generate_exportable_zip

View file

@ -60,10 +60,9 @@ class ZipExport < ApplicationRecord
fill_content(dir_to_zip, data, type, options)
zip!(dir_to_zip, output_file.path)
self.zip_file = File.open(output_file)
if save
FileUtils.rm_rf([dir_to_zip, output_file], secure: true)
generate_notification(user)
end
generate_notification(user) if save
ensure
FileUtils.rm_rf([dir_to_zip, output_file], secure: true)
end
handle_asynchronously :generate_exportable_zip