From 4814bc6c658a2d0cbf44186925ad47d7236ecf17 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 23 Jul 2015 11:36:11 +0200 Subject: [PATCH] Fix IOURC upload --- gns3server/handlers/upload_handler.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gns3server/handlers/upload_handler.py b/gns3server/handlers/upload_handler.py index 45e0cf4b..add34b40 100644 --- a/gns3server/handlers/upload_handler.py +++ b/gns3server/handlers/upload_handler.py @@ -77,12 +77,12 @@ class UploadHandler: else: destination_dir = os.path.join(UploadHandler.image_directory(), data["type"]) destination_path = os.path.join(destination_dir, data["file"].filename) - os.makedirs(destination_dir, exist_ok=True) - with open(destination_path, "wb+") as f: - chunk = data["file"].file.read() - f.write(chunk) - st = os.stat(destination_path) - os.chmod(destination_path, st.st_mode | stat.S_IXUSR) + os.makedirs(destination_dir, exist_ok=True) + with open(destination_path, "wb+") as f: + chunk = data["file"].file.read() + f.write(chunk) + st = os.stat(destination_path) + os.chmod(destination_path, st.st_mode | stat.S_IXUSR) except OSError as e: response.html("Could not upload file: {}".format(e)) response.set_status(200)