mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
If no files are uploaded, delete the empty receive mode dir that was created
This commit is contained in:
parent
95e6985f86
commit
89bed3c5ac
@ -546,18 +546,26 @@ class ReceiveModeRequest(Request):
|
||||
):
|
||||
# Inform the GUI that the upload has canceled
|
||||
self.web.add_request(
|
||||
self.web.REQUEST_UPLOAD_CANCELED, self.path, {"id": history_id}
|
||||
self.web.REQUEST_UPLOAD_CANCELED,
|
||||
self.path,
|
||||
{"id": history_id},
|
||||
)
|
||||
else:
|
||||
# Inform the GUI that the upload has finished
|
||||
self.web.add_request(
|
||||
self.web.REQUEST_UPLOAD_FINISHED, self.path, {"id": history_id}
|
||||
self.web.REQUEST_UPLOAD_FINISHED,
|
||||
self.path,
|
||||
{"id": history_id},
|
||||
)
|
||||
self.web.receive_mode.uploads_in_progress.remove(history_id)
|
||||
|
||||
except AttributeError:
|
||||
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):
|
||||
"""
|
||||
This function gets called when a specific file is written to.
|
||||
|
Loading…
Reference in New Issue
Block a user