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

Escape special characters from SVG text

Ref https://github.com/GNS3/gns3-server/issues/952
This commit is contained in:
Julien Duponchelle 2017-03-20 19:14:07 +01:00
parent 5409d9c3f8
commit 55563b9808
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
3 changed files with 7 additions and 4 deletions

View File

@ -18,6 +18,7 @@
import os
import re
import uuid
import html
import asyncio
import aiohttp
@ -83,7 +84,7 @@ class Link:
"x": -10,
"y": -10,
"rotation": 0,
"text": "{}/{}".format(adapter_number, port_number),
"text": html.escape("{}/{}".format(adapter_number, port_number)),
"style": "font-size: 10; font-style: Verdana"
}

View File

@ -17,6 +17,7 @@
import aiohttp
import asyncio
import html
import copy
import uuid
import os
@ -229,7 +230,7 @@ class Node:
self._label = {
"y": round(self._height / 2 + 10) * -1,
"text": self._name,
"text": html.escape(self._name),
"style": style,
"x": None, # None: mean the client should center it
"rotation": 0

View File

@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import html
import json
import copy
import uuid
@ -434,7 +435,7 @@ def _convert_1_3_later(topo, topo_path):
size=int(font_info[1]),
weight=weight,
style=style,
text=note["text"]
text=html.escape(note["text"])
)
new_note = {
"drawing_id": str(uuid.uuid4()),
@ -521,7 +522,7 @@ def _convert_label(label):
"""
style = qt_font_to_style(label.get("font"), label.get("color"))
return {
"text": label["text"],
"text": html.escape(label["text"]),
"rotation": 0,
"style": style,
"x": int(label["x"]),