1
0
mirror of https://github.com/GNS3/gns3-server synced 2025-02-26 07:02:12 +00:00

Fix creation of qemu img

Fix https://github.com/GNS3/gns3-gui/issues/1826
This commit is contained in:
Julien Duponchelle 2017-01-31 15:16:05 +01:00
parent bfbc6ff0be
commit 27a1089806
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -41,16 +41,15 @@ from ..config import Config
def parse_request(request, input_schema, raw): def parse_request(request, input_schema, raw):
"""Parse body of request and raise HTTP errors in case of problems""" """Parse body of request and raise HTTP errors in case of problems"""
content_length = request.content_length request.json = {}
if content_length is not None and content_length > 0 and not raw: if not raw:
body = yield from request.read() body = yield from request.read()
if body:
try: try:
request.json = json.loads(body.decode('utf-8')) request.json = json.loads(body.decode('utf-8'))
except ValueError as e: except ValueError as e:
request.json = {"malformed_json": body.decode('utf-8')} request.json = {"malformed_json": body.decode('utf-8')}
raise aiohttp.web.HTTPBadRequest(text="Invalid JSON {}".format(e)) raise aiohttp.web.HTTPBadRequest(text="Invalid JSON {}".format(e))
else:
request.json = {}
# Parse the query string # Parse the query string
if len(request.query_string) > 0: if len(request.query_string) > 0: