mirror of
https://github.com/onionshare/onionshare.git
synced 2025-04-28 11:16:08 -04:00
Catch more exceptions in ReceiveModeFile that trigger on a full disk
This commit is contained in:
parent
09c2696c27
commit
e625d3b009
@ -198,21 +198,24 @@ class ReceiveModeFile(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bytes_written = self.f.write(b)
|
bytes_written = self.f.write(b)
|
||||||
|
self.onionshare_write_func(self.onionshare_filename, bytes_written)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
# If we can't write the file, close early
|
|
||||||
self.upload_error = True
|
self.upload_error = True
|
||||||
return
|
|
||||||
self.onionshare_write_func(self.onionshare_filename, bytes_written)
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""
|
"""
|
||||||
Custom close method that calls out to onionshare_close_func
|
Custom close method that calls out to onionshare_close_func
|
||||||
"""
|
"""
|
||||||
self.f.close()
|
try:
|
||||||
|
self.f.close()
|
||||||
|
|
||||||
if not self.upload_error:
|
if not self.upload_error:
|
||||||
# Rename the in progress file to the final filename
|
# Rename the in progress file to the final filename
|
||||||
os.rename(self.filename_in_progress, self.filename)
|
os.rename(self.filename_in_progress, self.filename)
|
||||||
|
|
||||||
|
except:
|
||||||
|
self.upload_error = True
|
||||||
|
|
||||||
self.onionshare_close_func(self.onionshare_filename)
|
self.onionshare_close_func(self.onionshare_filename)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user