mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-18 11:39:22 -04:00
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
This commit is contained in:
parent
484aa23477
commit
7092e4ebee
2 changed files with 3 additions and 4 deletions
|
@ -525,6 +525,7 @@ class ShareModeWeb(SendBaseModeWeb):
|
||||||
|
|
||||||
# Make sure the zip file gets cleaned up when onionshare stops
|
# 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_filename)
|
||||||
|
self.web.cleanup_filenames.append(self.zip_writer.zip_temp_dir)
|
||||||
|
|
||||||
self.is_zipped = True
|
self.is_zipped = True
|
||||||
|
|
||||||
|
@ -545,8 +546,9 @@ class ZipWriter(object):
|
||||||
if zip_filename:
|
if zip_filename:
|
||||||
self.zip_filename = zip_filename
|
self.zip_filename = zip_filename
|
||||||
else:
|
else:
|
||||||
|
self.zip_temp_dir = tempfile.mkdtemp()
|
||||||
self.zip_filename = (
|
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)
|
self.z = zipfile.ZipFile(self.zip_filename, "w", allowZip64=True)
|
||||||
|
|
|
@ -47,9 +47,6 @@ class CompressThread(QtCore.QThread):
|
||||||
self.mode.filenames, processed_size_callback=self.set_processed_size
|
self.mode.filenames, processed_size_callback=self.set_processed_size
|
||||||
)
|
)
|
||||||
self.success.emit()
|
self.success.emit()
|
||||||
self.mode.web.cleanup_filenames += (
|
|
||||||
self.mode.web.share_mode.cleanup_filenames
|
|
||||||
)
|
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
self.error.emit(e.strerror)
|
self.error.emit(e.strerror)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue