mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Upload IOURC file via the web interface
This commit is contained in:
parent
ed2e4e43f2
commit
be1e0fa1f2
@ -55,11 +55,15 @@ class UploadHandler:
|
|||||||
response.redirect("/upload")
|
response.redirect("/upload")
|
||||||
return
|
return
|
||||||
|
|
||||||
if data["type"] not in ["IOU", "QEMU", "IOS"]:
|
if data["type"] not in ["IOU", "IOURC", "QEMU", "IOS"]:
|
||||||
raise HTTPForbidden("You are not authorized to upload this kind of image {}".format(data["type"]))
|
raise HTTPForbidden("You are not authorized to upload this kind of image {}".format(data["type"]))
|
||||||
|
|
||||||
destination_dir = os.path.join(UploadHandler.image_directory(), data["type"])
|
if data["type"] == "IOURC":
|
||||||
destination_path = os.path.join(destination_dir, data["file"].filename)
|
destination_dir = os.path.expanduser("~/")
|
||||||
|
destination_path = os.path.join(destination_dir, ".iourc")
|
||||||
|
else:
|
||||||
|
destination_dir = os.path.join(UploadHandler.image_directory(), data["type"])
|
||||||
|
destination_path = os.path.join(destination_dir, data["file"].filename)
|
||||||
try:
|
try:
|
||||||
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:
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
File: <input type="file" name="file" /><br>
|
File: <input type="file" name="file" /><br>
|
||||||
Image type: <select name="type" />
|
Image type: <select name="type" />
|
||||||
<option value="IOU">IOU</option>
|
<option value="IOU">IOU</option>
|
||||||
|
<option value="IOURC">IOU licence</option>
|
||||||
<option value="IOS">IOS</option>
|
<option value="IOS">IOS</option>
|
||||||
<option value="QEMU">Qemu</option>
|
<option value="QEMU">Qemu</option>
|
||||||
</select>
|
</select>
|
||||||
|
Loading…
Reference in New Issue
Block a user