1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00
This commit is contained in:
grossmj 2019-01-21 16:24:23 +07:00
parent e3757a8955
commit c14d79a3d5

View File

@ -112,14 +112,14 @@ def get_size(data, default_width=0, default_height=0):
if not viewbox: if not viewbox:
raise ValueError("Invalid SVG file: missing viewBox attribute") raise ValueError("Invalid SVG file: missing viewBox attribute")
_, _, viewbox_width, viewbox_height = re.split(r'[\s,]+', viewbox) _, _, viewbox_width, viewbox_height = re.split(r'[\s,]+', viewbox)
if width_attr.endswith("%"): if width_attr.endswith("%"):
width = _svg_convert_size(viewbox_width, width_attr) width = _svg_convert_size(viewbox_width, width_attr)
else: else:
width = _svg_convert_size(width_attr) width = _svg_convert_size(width_attr)
if height_attr.endswith("%"): if height_attr.endswith("%"):
height = _svg_convert_size(viewbox_height, height_attr) height = _svg_convert_size(viewbox_height, height_attr)
else: else:
height = _svg_convert_size(height_attr) height = _svg_convert_size(height_attr)
except (AttributeError, IndexError) as e: except (AttributeError, IndexError) as e:
raise ValueError("Invalid SVG file: {}".format(e)) raise ValueError("Invalid SVG file: {}".format(e))