Testing copying instead of moving upload file to avoid access error

This commit is contained in:
David Amrhein 2016-08-18 10:45:03 -04:00
parent 8c94b6243e
commit ba5cd741e1

View file

@ -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)