mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Fix IOURC upload
This commit is contained in:
parent
2655d426c2
commit
4814bc6c65
@ -77,12 +77,12 @@ class UploadHandler:
|
|||||||
else:
|
else:
|
||||||
destination_dir = os.path.join(UploadHandler.image_directory(), data["type"])
|
destination_dir = os.path.join(UploadHandler.image_directory(), data["type"])
|
||||||
destination_path = os.path.join(destination_dir, data["file"].filename)
|
destination_path = os.path.join(destination_dir, data["file"].filename)
|
||||||
os.makedirs(destination_dir, exist_ok=True)
|
os.makedirs(destination_dir, exist_ok=True)
|
||||||
with open(destination_path, "wb+") as f:
|
with open(destination_path, "wb+") as f:
|
||||||
chunk = data["file"].file.read()
|
chunk = data["file"].file.read()
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
st = os.stat(destination_path)
|
st = os.stat(destination_path)
|
||||||
os.chmod(destination_path, st.st_mode | stat.S_IXUSR)
|
os.chmod(destination_path, st.st_mode | stat.S_IXUSR)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
response.html("Could not upload file: {}".format(e))
|
response.html("Could not upload file: {}".format(e))
|
||||||
response.set_status(200)
|
response.set_status(200)
|
||||||
|
Loading…
Reference in New Issue
Block a user