mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-28 08:49:30 -05:00
Don't update the GUI at all untless it has been told about the request
This commit is contained in:
parent
02538520a2
commit
87d94f68e8
@ -278,8 +278,6 @@ class ReceiveModeRequest(Request):
|
|||||||
# Don't tell the GUI that a request has started until we start receiving files
|
# Don't tell the GUI that a request has started until we start receiving files
|
||||||
self.told_gui_about_request = False
|
self.told_gui_about_request = False
|
||||||
|
|
||||||
self.web.receive_mode.uploads_in_progress.append(self.upload_id)
|
|
||||||
|
|
||||||
self.previous_file = None
|
self.previous_file = None
|
||||||
|
|
||||||
def _get_file_stream(self, total_content_length, content_type, filename=None, content_length=None):
|
def _get_file_stream(self, total_content_length, content_type, filename=None, content_length=None):
|
||||||
@ -294,6 +292,8 @@ class ReceiveModeRequest(Request):
|
|||||||
'id': self.upload_id,
|
'id': self.upload_id,
|
||||||
'content_length': self.content_length
|
'content_length': self.content_length
|
||||||
})
|
})
|
||||||
|
self.web.receive_mode.uploads_in_progress.append(self.upload_id)
|
||||||
|
|
||||||
self.told_gui_about_request = True
|
self.told_gui_about_request = True
|
||||||
|
|
||||||
self.progress[filename] = {
|
self.progress[filename] = {
|
||||||
@ -309,12 +309,13 @@ class ReceiveModeRequest(Request):
|
|||||||
"""
|
"""
|
||||||
super(ReceiveModeRequest, self).close()
|
super(ReceiveModeRequest, self).close()
|
||||||
try:
|
try:
|
||||||
upload_id = self.upload_id
|
if self.told_gui_about_request:
|
||||||
# Inform the GUI that the upload has finished
|
upload_id = self.upload_id
|
||||||
self.web.add_request(self.web.REQUEST_UPLOAD_FINISHED, self.path, {
|
# Inform the GUI that the upload has finished
|
||||||
'id': upload_id
|
self.web.add_request(self.web.REQUEST_UPLOAD_FINISHED, self.path, {
|
||||||
})
|
'id': upload_id
|
||||||
self.web.receive_mode.uploads_in_progress.remove(upload_id)
|
})
|
||||||
|
self.web.receive_mode.uploads_in_progress.remove(upload_id)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -336,10 +337,11 @@ class ReceiveModeRequest(Request):
|
|||||||
), end='')
|
), end='')
|
||||||
|
|
||||||
# Update the GUI on the upload progress
|
# Update the GUI on the upload progress
|
||||||
self.web.add_request(self.web.REQUEST_PROGRESS, self.path, {
|
if self.told_gui_about_request:
|
||||||
'id': self.upload_id,
|
self.web.add_request(self.web.REQUEST_PROGRESS, self.path, {
|
||||||
'progress': self.progress
|
'id': self.upload_id,
|
||||||
})
|
'progress': self.progress
|
||||||
|
})
|
||||||
|
|
||||||
def file_close_func(self, filename):
|
def file_close_func(self, filename):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user