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

Fix invalid height for drawing images

Fix https://github.com/GNS3/gns3-gui/issues/1462
This commit is contained in:
Julien Duponchelle 2016-09-02 12:11:15 +02:00
parent 43afce740d
commit 2d86a7fdcf
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -73,7 +73,7 @@ class Drawing:
return data.decode()
except UnicodeError:
width, height, filetype = get_size(data)
return "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" height=\"{height}\" width=\"{width}\">\n<image height=\"{height}\" width=\"{width}\" xlink:href=\"data:image/{filetype};base64,{b64}\" />\n</svg>".format(b64=base64.b64encode(data).decode(), filetype=filetype, width=width, height=width)
return "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" height=\"{height}\" width=\"{width}\">\n<image height=\"{height}\" width=\"{width}\" xlink:href=\"data:image/{filetype};base64,{b64}\" />\n</svg>".format(b64=base64.b64encode(data).decode(), filetype=filetype, width=width, height=height)
except OSError:
log.warning("Image file %s missing", filename)
return "<svg></svg>"
@ -172,7 +172,7 @@ class Drawing:
svg_changed = False
for prop in kwargs:
if prop == "drawing_id":
pass # No good reason to change a drawing_id
pass # No good reason to change a drawing_id
elif getattr(self, prop) != kwargs[prop]:
if prop == "svg":
# To avoid spamming client with large data we don't send the svg if the SVG didn't change