Don't update the GUI at all untless it has been told about the request

This commit is contained in:
Micah Lee 2019-01-21 11:16:55 -08:00
parent 02538520a2
commit 87d94f68e8
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -278,8 +278,6 @@ class ReceiveModeRequest(Request):
# 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)
self.previous_file = 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,
'content_length': self.content_length
})
self.web.receive_mode.uploads_in_progress.append(self.upload_id)
self.told_gui_about_request = True
self.progress[filename] = {
@ -309,6 +309,7 @@ class ReceiveModeRequest(Request):
"""
super(ReceiveModeRequest, self).close()
try:
if self.told_gui_about_request:
upload_id = self.upload_id
# Inform the GUI that the upload has finished
self.web.add_request(self.web.REQUEST_UPLOAD_FINISHED, self.path, {
@ -336,6 +337,7 @@ class ReceiveModeRequest(Request):
), end='')
# Update the GUI on the upload progress
if self.told_gui_about_request:
self.web.add_request(self.web.REQUEST_PROGRESS, self.path, {
'id': self.upload_id,
'progress': self.progress