From c6ccd4de579332187232f0e4bfeb33fe531f76d8 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Tue, 4 May 2021 16:42:23 +1000 Subject: Remove unnecessary cleanup_filenames appending in the CompressThread. Ensure we also remove the temp dir that a Zip file is made within, by setting the temp dir in ZipWriter as a variable --- cli/onionshare_cli/web/share_mode.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/onionshare_cli/web/share_mode.py b/cli/onionshare_cli/web/share_mode.py index c5007d7f..95aec1ba 100644 --- a/cli/onionshare_cli/web/share_mode.py +++ b/cli/onionshare_cli/web/share_mode.py @@ -525,6 +525,7 @@ class ShareModeWeb(SendBaseModeWeb): # Make sure the zip file gets cleaned up when onionshare stops self.web.cleanup_filenames.append(self.zip_writer.zip_filename) + self.web.cleanup_filenames.append(self.zip_writer.zip_temp_dir) self.is_zipped = True @@ -545,8 +546,9 @@ class ZipWriter(object): if zip_filename: self.zip_filename = zip_filename else: + self.zip_temp_dir = tempfile.mkdtemp() self.zip_filename = ( - f"{tempfile.mkdtemp()}/onionshare_{self.common.random_string(4, 6)}.zip" + f"{self.zip_temp_dir}/onionshare_{self.common.random_string(4, 6)}.zip" ) self.z = zipfile.ZipFile(self.zip_filename, "w", allowZip64=True) -- cgit v1.2.3-54-g00ecf