Escape special chars like "&"

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-08-06 18:03:17 +02:00
parent ce582d9534
commit b199056944
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,4 @@
import html
import os
BTN_LEFT = 1
@ -77,6 +78,9 @@ class Block:
text=text,
))
def safe_text(self, text):
return html.escape(text)
def set_icon(self, icon):
"""
Overwrites the icon speicfied in constructor

View file

@ -50,10 +50,10 @@ class Spotify(Block):
'Metadata',
)
return "{} - {}".format(
return self.safe_text("{} - {}".format(
meta.get('xesam:artist')[0],
meta.get('xesam:title'),
)
))
def main():