summaryrefslogtreecommitdiff
path: root/onionshare
diff options
context:
space:
mode:
authorMiguel Jacq <mig@mig5.net>2018-10-02 08:22:08 +1000
committerMiguel Jacq <mig@mig5.net>2018-10-02 08:22:08 +1000
commit61d2e6cc5f70f9761b2988d9bb5c1a4e52593a86 (patch)
tree21478fa1f24feed0418af078950ad374d0c51039 /onionshare
parente9148ddb49a982033eee575d19bbc741e0616b48 (diff)
downloadonionshare-61d2e6cc5f70f9761b2988d9bb5c1a4e52593a86.tar.gz
onionshare-61d2e6cc5f70f9761b2988d9bb5c1a4e52593a86.zip
Try to fix logic handling last upload after timer expiry
Diffstat (limited to 'onionshare')
-rw-r--r--onionshare/web/receive_mode.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/onionshare/web/receive_mode.py b/onionshare/web/receive_mode.py
index bc5e1734..60909a23 100644
--- a/onionshare/web/receive_mode.py
+++ b/onionshare/web/receive_mode.py
@@ -243,7 +243,11 @@ class ReceiveModeRequest(Request):
if self.path == '/upload':
self.upload_request = True
- if self.upload_request and self.web.receive_mode.can_upload:
+ # Prevent new uploads if we've said so (timer expired)
+ if not self.web.receive_mode.can_upload:
+ self.upload_request = False
+
+ if self.upload_request:
# A dictionary that maps filenames to the bytes uploaded so far
self.progress = {}
@@ -290,16 +294,11 @@ class ReceiveModeRequest(Request):
"""
super(ReceiveModeRequest, self).close()
if self.upload_request:
- try:
- upload_id = self.upload_id
- # Inform the GUI that the upload has finished
- self.web.add_request(self.web.REQUEST_UPLOAD_FINISHED, self.path, {
- 'id': upload_id
- })
-
- except AttributeError:
- # We may not have got an upload_id (e.g uploads were rejected)
- pass
+ # Inform the GUI that the upload has finished
+ self.web.add_request(self.web.REQUEST_UPLOAD_FINISHED, self.path, {
+ 'id': self.upload_id
+ })
+
def file_write_func(self, filename, length):
"""