1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Fix issue preventing to use custom nested symbols. Fixes #1969

This commit is contained in:
grossmj 2021-09-08 15:13:51 +09:30
parent e026c1e91f
commit 6f1feed265

View File

@ -25,6 +25,7 @@ import os
from .compute import ComputeConflict, ComputeError from .compute import ComputeConflict, ComputeError
from .ports.port_factory import PortFactory, StandardPortFactory, DynamipsPortFactory from .ports.port_factory import PortFactory, StandardPortFactory, DynamipsPortFactory
from ..utils.images import images_directories from ..utils.images import images_directories
from ..config import Config
from ..utils.qt import qt_font_to_style from ..utils.qt import qt_font_to_style
@ -263,9 +264,11 @@ class Node:
if val is None: if val is None:
val = ":/symbols/computer.svg" val = ":/symbols/computer.svg"
# No abs path, fix them (bug of 1.X)
try: try:
if not val.startswith(":") and os.path.abspath(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) val = os.path.basename(val)
except OSError: except OSError:
pass pass