1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Merge pull request #1230 from GNS3/consitance-about-exc

Keep consistance of aiohttp.web.HTTPForbidden() execution
This commit is contained in:
Jeremy Grossmann 2017-11-23 23:02:42 +07:00 committed by GitHub
commit a80355998d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 10 deletions

View File

@ -407,6 +407,6 @@ class IOUHandler:
# Raise error if user try to escape # Raise error if user try to escape
if filename[0] == ".": if filename[0] == ".":
raise aiohttp.web.HTTPForbidden raise aiohttp.web.HTTPForbidden()
yield from response.file(image_path) yield from response.file(image_path)

View File

@ -231,7 +231,7 @@ class ProjectHandler:
# Raise error if user try to escape # Raise error if user try to escape
if path[0] == ".": if path[0] == ".":
raise aiohttp.web.HTTPForbidden raise aiohttp.web.HTTPForbidden()
path = os.path.join(project.path, path) path = os.path.join(project.path, path)
response.content_type = "application/octet-stream" response.content_type = "application/octet-stream"
@ -272,7 +272,7 @@ class ProjectHandler:
# Raise an error if user try to escape # Raise an error if user try to escape
if path[0] == ".": if path[0] == ".":
raise aiohttp.web.HTTPForbidden raise aiohttp.web.HTTPForbidden()
path = os.path.join(project.path, path) path = os.path.join(project.path, path)
response.content_type = "application/octet-stream" response.content_type = "application/octet-stream"
@ -314,7 +314,7 @@ class ProjectHandler:
# Raise error if user try to escape # Raise error if user try to escape
if path[0] == ".": if path[0] == ".":
raise aiohttp.web.HTTPForbidden raise aiohttp.web.HTTPForbidden()
path = os.path.join(project.path, path) path = os.path.join(project.path, path)
response.set_status(200) response.set_status(200)

View File

@ -498,6 +498,6 @@ class QEMUHandler:
# Raise error if user try to escape # Raise error if user try to escape
if filename[0] == ".": if filename[0] == ".":
raise aiohttp.web.HTTPForbidden raise aiohttp.web.HTTPForbidden()
yield from response.file(image_path) yield from response.file(image_path)

View File

@ -15,7 +15,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import aiohttp import aiohttp
from gns3server.web.route import Route from gns3server.web.route import Route
@ -370,7 +369,7 @@ class NodeHandler:
# Raise error if user try to escape # Raise error if user try to escape
if path[0] == ".": if path[0] == ".":
raise aiohttp.web.HTTPForbidden raise aiohttp.web.HTTPForbidden()
node_type = node.node_type node_type = node.node_type
path = "/project-files/{}/{}/{}".format(node_type, node.id, path) path = "/project-files/{}/{}/{}".format(node_type, node.id, path)
@ -406,7 +405,7 @@ class NodeHandler:
# Raise error if user try to escape # Raise error if user try to escape
if path[0] == ".": if path[0] == ".":
raise aiohttp.web.HTTPForbidden raise aiohttp.web.HTTPForbidden()
node_type = node.node_type node_type = node.node_type
path = "/project-files/{}/{}/{}".format(node_type, node.id, path) path = "/project-files/{}/{}/{}".format(node_type, node.id, path)

View File

@ -398,7 +398,7 @@ class ProjectHandler:
# Raise error if user try to escape # Raise error if user try to escape
if path[0] == ".": if path[0] == ".":
raise aiohttp.web.HTTPForbidden raise aiohttp.web.HTTPForbidden()
path = os.path.join(project.path, path) path = os.path.join(project.path, path)
response.content_type = "application/octet-stream" response.content_type = "application/octet-stream"
@ -440,7 +440,7 @@ class ProjectHandler:
# Raise error if user try to escape # Raise error if user try to escape
if path[0] == ".": if path[0] == ".":
raise aiohttp.web.HTTPForbidden raise aiohttp.web.HTTPForbidden()
path = os.path.join(project.path, path) path = os.path.join(project.path, path)
response.set_status(200) response.set_status(200)