mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-28 16:59:35 -05:00
Try and fix closing the request for a valid upload post-timer expiry, whilst still rejecting subsequent uploads
This commit is contained in:
parent
875b538347
commit
db8548c35b
@ -244,14 +244,13 @@ class ReceiveModeRequest(Request):
|
|||||||
if self.path == '/upload':
|
if self.path == '/upload':
|
||||||
self.upload_request = True
|
self.upload_request = True
|
||||||
|
|
||||||
# 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:
|
if self.upload_request:
|
||||||
# A dictionary that maps filenames to the bytes uploaded so far
|
# A dictionary that maps filenames to the bytes uploaded so far
|
||||||
self.progress = {}
|
self.progress = {}
|
||||||
|
|
||||||
|
# Prevent new uploads if we've said so (timer expired)
|
||||||
|
if self.web.receive_mode.can_upload:
|
||||||
|
|
||||||
# Create an upload_id, attach it to the request
|
# Create an upload_id, attach it to the request
|
||||||
self.upload_id = self.web.receive_mode.upload_count
|
self.upload_id = self.web.receive_mode.upload_count
|
||||||
|
|
||||||
@ -296,13 +295,16 @@ class ReceiveModeRequest(Request):
|
|||||||
Closing the request.
|
Closing the request.
|
||||||
"""
|
"""
|
||||||
super(ReceiveModeRequest, self).close()
|
super(ReceiveModeRequest, self).close()
|
||||||
if self.upload_request:
|
try:
|
||||||
|
upload_id = self.upload_id
|
||||||
|
self.web.common.log('ReceiveModeWeb', 'We finished our upload')
|
||||||
# Inform the GUI that the upload has finished
|
# Inform the GUI that the upload has finished
|
||||||
self.web.add_request(self.web.REQUEST_UPLOAD_FINISHED, self.path, {
|
self.web.add_request(self.web.REQUEST_UPLOAD_FINISHED, self.path, {
|
||||||
'id': self.upload_id
|
'id': upload_id
|
||||||
})
|
})
|
||||||
self.web.receive_mode.uploads_in_progress.remove(self.upload_id)
|
self.web.receive_mode.uploads_in_progress.remove(upload_id)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
def file_write_func(self, filename, length):
|
def file_write_func(self, filename, length):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user