diff options
author | Micah Lee <micah@micahflee.com> | 2019-01-20 16:20:36 -0800 |
---|---|---|
committer | Micah Lee <micah@micahflee.com> | 2019-01-20 16:20:36 -0800 |
commit | 04e43856673abcb4ec9830022f5b3b800b5b44d8 (patch) | |
tree | 2b9633bb979bfc2e8c86c39efb822cda5e6ceb9f | |
parent | a1f8f0bd2bfbe8adf63fafe0be5e176e1d8f17fd (diff) | |
download | onionshare-04e43856673abcb4ec9830022f5b3b800b5b44d8.tar.gz onionshare-04e43856673abcb4ec9830022f5b3b800b5b44d8.zip |
In receive mode, only tell the GUI that a new request is coming in if it contains files
-rw-r--r-- | onionshare/web/receive_mode.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/onionshare/web/receive_mode.py b/onionshare/web/receive_mode.py index 2b4e8faf..c319ce13 100644 --- a/onionshare/web/receive_mode.py +++ b/onionshare/web/receive_mode.py @@ -275,11 +275,8 @@ class ReceiveModeRequest(Request): strings._("receive_mode_upload_starting").format(self.web.common.human_readable_filesize(self.content_length)) )) - # Tell the GUI - self.web.add_request(self.web.REQUEST_STARTED, self.path, { - 'id': self.upload_id, - 'content_length': self.content_length - }) + # Don't tell the GUI that a request has started until we start receiving files + self.told_gui_about_request = False self.web.receive_mode.uploads_in_progress.append(self.upload_id) @@ -291,6 +288,14 @@ class ReceiveModeRequest(Request): writable stream. """ if self.upload_request: + if not self.told_gui_about_request: + # Tell the GUI about the request + self.web.add_request(self.web.REQUEST_STARTED, self.path, { + 'id': self.upload_id, + 'content_length': self.content_length + }) + self.told_gui_about_request = True + self.progress[filename] = { 'uploaded_bytes': 0, 'complete': False |