only check resume file if set
This commit is contained in:
parent
9e40462d78
commit
69b6e08731
1 changed files with 10 additions and 9 deletions
|
@ -1078,7 +1078,7 @@ class API(ox.API):
|
|||
def upload_chunks(self, url, filename, data=None):
|
||||
form = ox.MultiPartForm()
|
||||
resume = None
|
||||
if os.path.exists(self._resume_file):
|
||||
if self._resume_file and os.path.exists(self._resume_file):
|
||||
with open(self._resume_file) as f:
|
||||
try:
|
||||
resume = json.load(f)
|
||||
|
@ -1165,6 +1165,7 @@ class API(ox.API):
|
|||
print('server offset out of sync, continue from', data['offset'])
|
||||
done = data['offset']
|
||||
f.seek(done)
|
||||
if self._resume_file:
|
||||
with open(self._resume_file, 'w') as r:
|
||||
json.dump({
|
||||
'uploadUrl': uploadUrl,
|
||||
|
@ -1173,7 +1174,7 @@ class API(ox.API):
|
|||
'offset': done
|
||||
}, r, indent=2)
|
||||
chunk = f.read(CHUNK_SIZE)
|
||||
if os.path.exists(self._resume_file):
|
||||
if self._resume_file and os.path.exists(self._resume_file):
|
||||
os.unlink(self._resume_file)
|
||||
resume = None
|
||||
if result_url:
|
||||
|
|
Loading…
Reference in a new issue