From 81fa5e052cf4e959670f02f738c35c1148857b91 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 20 Sep 2018 23:18:17 -0700 Subject: [PATCH] Only add the download_filename to cleanup_filenames (which get deleted) if the file is zipped up. Otherwise, OnionShare deletes the original file --- onionshare/__init__.py | 3 ++- onionshare_gui/share_mode/threads.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/onionshare/__init__.py b/onionshare/__init__.py index e04836b7..2f57ccf2 100644 --- a/onionshare/__init__.py +++ b/onionshare/__init__.py @@ -120,7 +120,8 @@ def main(cwd=None): print(strings._("preparing_files")) try: web.set_file_info(filenames) - app.cleanup_filenames.append(web.download_filename) + if web.is_zipped: + app.cleanup_filenames.append(web.download_filename) except OSError as e: print(e.strerror) sys.exit(1) diff --git a/onionshare_gui/share_mode/threads.py b/onionshare_gui/share_mode/threads.py index 9cda76b1..dc43bf0a 100644 --- a/onionshare_gui/share_mode/threads.py +++ b/onionshare_gui/share_mode/threads.py @@ -47,7 +47,8 @@ class CompressThread(QtCore.QThread): # Cancelled pass - self.mode.app.cleanup_filenames.append(self.mode.web.download_filename) + if self.mode.web.is_zipped: + self.mode.app.cleanup_filenames.append(self.mode.web.download_filename) except OSError as e: self.error.emit(e.strerror)