From 868c39acfe8a9cecb2f7224f5ba3137db25bc157 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 14 Mar 2020 17:22:43 +1030 Subject: [PATCH] Fix issues with empty project variables. Fixes https://github.com/GNS3/gns3-gui/issues/2941 --- gns3server/controller/topology.py | 5 +++++ gns3server/schemas/project.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 2c1a6b89..8e764472 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -171,6 +171,11 @@ def load_topology(path): if "console_type" in node and node["console_type"] is None: node["console_type"] = "none" + # make sure we can open a project with empty variable name + variables = topo.get("variables") + if variables: + topo["variables"] = [var for var in variables if var.get("name")] + try: _check_topology_schema(topo) except aiohttp.web.HTTPConflict as e: diff --git a/gns3server/schemas/project.py b/gns3server/schemas/project.py index 23f23ac2..1c4e50d1 100644 --- a/gns3server/schemas/project.py +++ b/gns3server/schemas/project.py @@ -38,7 +38,8 @@ VARIABLES_OBJECT_SCHEMA = { "properties": { "name": { "type": "string", - "description": "Variable name" + "description": "Variable name", + "minLength": 1 }, "value": { "type": "string",