From 836b163ce1ad276d125510439c64deba06529c0b Mon Sep 17 00:00:00 2001 From: Marcus Lundblad Date: Thu, 26 Sep 2024 22:35:13 +0200 Subject: [PATCH] transitLegRow: Escape agency name Since the agency name label accepts markup (for the case when showing a URL) the name needs to be escaped, as it could contain characters like e.g. &. --- src/transitLegRow.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/transitLegRow.js b/src/transitLegRow.js index 1f47d563..d6b2a73e 100644 --- a/src/transitLegRow.js +++ b/src/transitLegRow.js @@ -47,7 +47,8 @@ export class TransitLegRow extends Gtk.ListBoxRow { this._fromLabel.label = Transit.getFromLabel(this._leg, this._start); if (this._leg.transit) { - let routeLabel = new TransitRouteLabel({ leg: this._leg }); + const routeLabel = new TransitRouteLabel({ leg: this._leg }); + const agencyName = GLib.markup_escape_text(this._leg.agencyName, -1); this._routeGrid.attach(routeLabel, 0, 0, 1, 1); @@ -61,9 +62,9 @@ export class TransitLegRow extends Gtk.ListBoxRow { let tooltip = GLib.markup_escape_text(url, -1); this._agencyLabel.label = '%s'.format(url, tooltip, - this._leg.agencyName); + agencyName); } else { - this._agencyLabel.label = this._leg.agencyName; + this._agencyLabel.label = agencyName; } } else { this._expandButton.tooltip_text = _("Show walking instructions"); -- GitLab