From 77bfb451886711cb3baa72a4fe3c3bf03649305f Mon Sep 17 00:00:00 2001 From: Sander Sweers Date: Tue, 16 Jul 2024 19:04:33 +0200 Subject: [PATCH] RecentConns: Alias may contain < > which causes parse errors For example in the StatusNotifierItem. fixes #2429 --- blueman/plugins/applet/RecentConns.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/blueman/plugins/applet/RecentConns.py b/blueman/plugins/applet/RecentConns.py index 84ec37a07..65fd13bc1 100644 --- a/blueman/plugins/applet/RecentConns.py +++ b/blueman/plugins/applet/RecentConns.py @@ -1,5 +1,6 @@ from gettext import gettext as _ from operator import itemgetter +import html import time import logging from typing import List, TYPE_CHECKING, Optional, Callable, cast, Union @@ -167,8 +168,9 @@ def err(reason: Union[Exception, str]) -> None: self.parent.Plugins.DBusService.connect_service(item["device"], item["uuid"], reply, err) def _build_menu_item(self, item: "Item") -> "SubmenuItemDict": + alias = html.escape(item["alias"]) mitem: "SubmenuItemDict" = { - "text": _("%(service)s on %(device)s") % {"service": item["name"], "device": item["alias"]}, + "text": _("%(service)s on %(device)s") % {"service": item["name"], "device": alias}, "markup": True, "icon_name": item["mitem"]["icon_name"] if item["mitem"] is not None else item["icon"], "sensitive": item["device"] is not None,