From fe60c414b99bd015196cf5bcb4cce05f9f975416 Mon Sep 17 00:00:00 2001 From: ziajka Date: Thu, 23 Nov 2017 16:28:10 +0100 Subject: [PATCH] Keep consistance of aiohttp.web.HTTPForbidden() execution --- gns3server/handlers/api/compute/iou_handler.py | 2 +- gns3server/handlers/api/compute/project_handler.py | 6 +++--- gns3server/handlers/api/compute/qemu_handler.py | 2 +- gns3server/handlers/api/controller/node_handler.py | 5 ++--- gns3server/handlers/api/controller/project_handler.py | 4 ++-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gns3server/handlers/api/compute/iou_handler.py b/gns3server/handlers/api/compute/iou_handler.py index d6868647..029e8c27 100644 --- a/gns3server/handlers/api/compute/iou_handler.py +++ b/gns3server/handlers/api/compute/iou_handler.py @@ -407,6 +407,6 @@ class IOUHandler: # Raise error if user try to escape if filename[0] == ".": - raise aiohttp.web.HTTPForbidden + raise aiohttp.web.HTTPForbidden() yield from response.file(image_path) diff --git a/gns3server/handlers/api/compute/project_handler.py b/gns3server/handlers/api/compute/project_handler.py index fec5bf44..73662ca7 100644 --- a/gns3server/handlers/api/compute/project_handler.py +++ b/gns3server/handlers/api/compute/project_handler.py @@ -231,7 +231,7 @@ class ProjectHandler: # Raise error if user try to escape if path[0] == ".": - raise aiohttp.web.HTTPForbidden + raise aiohttp.web.HTTPForbidden() path = os.path.join(project.path, path) response.content_type = "application/octet-stream" @@ -272,7 +272,7 @@ class ProjectHandler: # Raise an error if user try to escape if path[0] == ".": - raise aiohttp.web.HTTPForbidden + raise aiohttp.web.HTTPForbidden() path = os.path.join(project.path, path) response.content_type = "application/octet-stream" @@ -314,7 +314,7 @@ class ProjectHandler: # Raise error if user try to escape if path[0] == ".": - raise aiohttp.web.HTTPForbidden + raise aiohttp.web.HTTPForbidden() path = os.path.join(project.path, path) response.set_status(200) diff --git a/gns3server/handlers/api/compute/qemu_handler.py b/gns3server/handlers/api/compute/qemu_handler.py index 44002196..129ac0d9 100644 --- a/gns3server/handlers/api/compute/qemu_handler.py +++ b/gns3server/handlers/api/compute/qemu_handler.py @@ -498,6 +498,6 @@ class QEMUHandler: # Raise error if user try to escape if filename[0] == ".": - raise aiohttp.web.HTTPForbidden + raise aiohttp.web.HTTPForbidden() yield from response.file(image_path) diff --git a/gns3server/handlers/api/controller/node_handler.py b/gns3server/handlers/api/controller/node_handler.py index 9424ea9b..808390ab 100644 --- a/gns3server/handlers/api/controller/node_handler.py +++ b/gns3server/handlers/api/controller/node_handler.py @@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import aiohttp from gns3server.web.route import Route @@ -370,7 +369,7 @@ class NodeHandler: # Raise error if user try to escape if path[0] == ".": - raise aiohttp.web.HTTPForbidden + raise aiohttp.web.HTTPForbidden() node_type = node.node_type path = "/project-files/{}/{}/{}".format(node_type, node.id, path) @@ -406,7 +405,7 @@ class NodeHandler: # Raise error if user try to escape if path[0] == ".": - raise aiohttp.web.HTTPForbidden + raise aiohttp.web.HTTPForbidden() node_type = node.node_type path = "/project-files/{}/{}/{}".format(node_type, node.id, path) diff --git a/gns3server/handlers/api/controller/project_handler.py b/gns3server/handlers/api/controller/project_handler.py index 82e29a57..8d7337dd 100644 --- a/gns3server/handlers/api/controller/project_handler.py +++ b/gns3server/handlers/api/controller/project_handler.py @@ -398,7 +398,7 @@ class ProjectHandler: # Raise error if user try to escape if path[0] == ".": - raise aiohttp.web.HTTPForbidden + raise aiohttp.web.HTTPForbidden() path = os.path.join(project.path, path) response.content_type = "application/octet-stream" @@ -440,7 +440,7 @@ class ProjectHandler: # Raise error if user try to escape if path[0] == ".": - raise aiohttp.web.HTTPForbidden + raise aiohttp.web.HTTPForbidden() path = os.path.join(project.path, path) response.set_status(200)