Testing copying instead of moving upload file to avoid access error
This commit is contained in:
parent
8c94b6243e
commit
ba5cd741e1
1 changed files with 9 additions and 3 deletions
|
@ -377,10 +377,16 @@ class LBRYFileUpload(resource.Resource):
|
||||||
# Move to a new temporary dir and restore the original file name
|
# Move to a new temporary dir and restore the original file name
|
||||||
newdirpath = tempfile.mkdtemp()
|
newdirpath = tempfile.mkdtemp()
|
||||||
newpath = os.path.join(newdirpath, origfilename)
|
newpath = os.path.join(newdirpath, origfilename)
|
||||||
|
if os.name == "nt":
|
||||||
|
print('Debugging: shutil.copy({0}, {1}'.format(uploaded_file.name, newpath))
|
||||||
|
shutil.copy(uploaded_file.name, newpath)
|
||||||
|
# TODO Still need to remove the file
|
||||||
try:
|
try:
|
||||||
|
os.remove(uploaded_file.name)
|
||||||
|
except WindowsError as e:
|
||||||
|
print(e)
|
||||||
|
else:
|
||||||
shutil.move(uploaded_file.name, newpath)
|
shutil.move(uploaded_file.name, newpath)
|
||||||
except WindowsError:
|
|
||||||
pass
|
|
||||||
self._api.uploaded_temp_files.append(newpath)
|
self._api.uploaded_temp_files.append(newpath)
|
||||||
|
|
||||||
return json.dumps(newpath)
|
return json.dumps(newpath)
|
||||||
|
|
Loading…
Reference in a new issue