mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-29 02:08:10 +00:00
Fix creation of qemu img
Fix https://github.com/GNS3/gns3-gui/issues/1826
This commit is contained in:
parent
bfbc6ff0be
commit
27a1089806
@ -41,16 +41,15 @@ from ..config import Config
|
||||
def parse_request(request, input_schema, raw):
|
||||
"""Parse body of request and raise HTTP errors in case of problems"""
|
||||
|
||||
content_length = request.content_length
|
||||
if content_length is not None and content_length > 0 and not raw:
|
||||
request.json = {}
|
||||
if not raw:
|
||||
body = yield from request.read()
|
||||
try:
|
||||
request.json = json.loads(body.decode('utf-8'))
|
||||
except ValueError as e:
|
||||
request.json = {"malformed_json": body.decode('utf-8')}
|
||||
raise aiohttp.web.HTTPBadRequest(text="Invalid JSON {}".format(e))
|
||||
else:
|
||||
request.json = {}
|
||||
if body:
|
||||
try:
|
||||
request.json = json.loads(body.decode('utf-8'))
|
||||
except ValueError as e:
|
||||
request.json = {"malformed_json": body.decode('utf-8')}
|
||||
raise aiohttp.web.HTTPBadRequest(text="Invalid JSON {}".format(e))
|
||||
|
||||
# Parse the query string
|
||||
if len(request.query_string) > 0:
|
||||
|
Loading…
Reference in New Issue
Block a user