mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 02:32:58 -03:00
If no files are uploaded, delete the empty receive mode dir that was created
This commit is contained in:
parent
95e6985f86
commit
89bed3c5ac
1 changed files with 27 additions and 19 deletions
|
@ -536,27 +536,35 @@ class ReceiveModeRequest(Request):
|
||||||
if self.upload_request:
|
if self.upload_request:
|
||||||
self.web.common.log("ReceiveModeRequest", "close")
|
self.web.common.log("ReceiveModeRequest", "close")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.told_gui_about_request:
|
if self.told_gui_about_request:
|
||||||
history_id = self.history_id
|
history_id = self.history_id
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not self.web.stop_q.empty()
|
not self.web.stop_q.empty()
|
||||||
or not self.progress[self.filename]["complete"]
|
or not self.progress[self.filename]["complete"]
|
||||||
):
|
):
|
||||||
# Inform the GUI that the upload has canceled
|
# Inform the GUI that the upload has canceled
|
||||||
self.web.add_request(
|
self.web.add_request(
|
||||||
self.web.REQUEST_UPLOAD_CANCELED, self.path, {"id": history_id}
|
self.web.REQUEST_UPLOAD_CANCELED,
|
||||||
)
|
self.path,
|
||||||
else:
|
{"id": history_id},
|
||||||
# Inform the GUI that the upload has finished
|
)
|
||||||
self.web.add_request(
|
else:
|
||||||
self.web.REQUEST_UPLOAD_FINISHED, self.path, {"id": history_id}
|
# Inform the GUI that the upload has finished
|
||||||
)
|
self.web.add_request(
|
||||||
self.web.receive_mode.uploads_in_progress.remove(history_id)
|
self.web.REQUEST_UPLOAD_FINISHED,
|
||||||
|
self.path,
|
||||||
|
{"id": history_id},
|
||||||
|
)
|
||||||
|
self.web.receive_mode.uploads_in_progress.remove(history_id)
|
||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# If no files were written to self.receive_mode_dir, delete it
|
||||||
|
if len(os.listdir(self.receive_mode_dir)) == 0:
|
||||||
|
os.rmdir(self.receive_mode_dir)
|
||||||
|
|
||||||
def file_write_func(self, filename, length):
|
def file_write_func(self, filename, length):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue