From 6f1feed265ead8057b4a33231a7418acf21004d9 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 8 Sep 2021 15:13:51 +0930 Subject: [PATCH] Fix issue preventing to use custom nested symbols. Fixes #1969 --- gns3server/controller/node.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gns3server/controller/node.py b/gns3server/controller/node.py index 8de40aa6..b2fc0212 100644 --- a/gns3server/controller/node.py +++ b/gns3server/controller/node.py @@ -25,6 +25,7 @@ import os from .compute import ComputeConflict, ComputeError from .ports.port_factory import PortFactory, StandardPortFactory, DynamipsPortFactory from ..utils.images import images_directories +from ..config import Config from ..utils.qt import qt_font_to_style @@ -263,10 +264,12 @@ class Node: if val is None: val = ":/symbols/computer.svg" - # No abs path, fix them (bug of 1.X) try: - if not val.startswith(":") and os.path.abspath(val): - val = os.path.basename(val) + if not val.startswith(":") and os.path.isabs(val): + server_config = Config.instance().get_section_config("Server") + default_symbol_directory = os.path.expanduser(server_config.get("images_path", "~/GNS3/symbols")) + if os.path.commonprefix([default_symbol_directory, val]) != default_symbol_directory: + val = os.path.basename(val) except OSError: pass