mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Merge branch '2.1' into 2.2
# Conflicts: # gns3server/version.py # requirements.txt
This commit is contained in:
commit
96d5e351f7
235 files changed
+3037
-864
No files matched your search
@@ -158,7 +158,7 @@ def md5sum(path, stopped_event=None):
|
||||
|
||||
try:
|
||||
with open(path + '.md5sum') as f:
|
||||
md5 = f.read()
|
||||
md5 = f.read().strip()
|
||||
if len(md5) == 32:
|
||||
return md5
|
||||
# Unicode error is when user rename an image to .md5sum ....
|
||||
|
||||
@@ -103,10 +103,16 @@ def get_size(data, default_width=0, default_height=0):
|
||||
root = tree.getroot()
|
||||
|
||||
try:
|
||||
width = _svg_convert_size(root.attrib.get("width", "0"))
|
||||
height = _svg_convert_size(root.attrib.get("height", "0"))
|
||||
except IndexError:
|
||||
raise ValueError("Invalid SVG file")
|
||||
width_attr = root.attrib.get("width", "0")
|
||||
height_attr = root.attrib.get("height", "0")
|
||||
if width_attr.endswith("%") or height_attr.endswith("%"):
|
||||
# check to viewBox attribute if width or height value is a percentage
|
||||
_, _, width_attr, height_attr = root.attrib.get("viewBox").split()
|
||||
else:
|
||||
width = _svg_convert_size(width_attr)
|
||||
height = _svg_convert_size(height_attr)
|
||||
except (AttributeError, IndexError) as e:
|
||||
raise ValueError("Invalid SVG file: {}".format(e))
|
||||
|
||||
return width, height, filetype
|
||||
|
||||
|
||||
Reference in new issue
Block a user