[gnome-control-center/wip/hadess/wifi-escape-ssid] network: Fix Wi-Fi network with "&" in name not appearing




commit fdc5e4f4e6bf4adbf8d8e4711914cbec06eb5ae2
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jun 9 15:21:56 2022 +0200

    network: Fix Wi-Fi network with "&" in name not appearing
    
    My neighbours' Wi-Fi makes the Wi-Fi panel throw an error:
    (gnome-control-center:346639): Gtk-WARNING **: 15:16:21.993: Failed to set text 'Bbox Hugo & Laura' from 
markup due to error parsing markup: Error on line 1: Entity did not end with a semicolon; most likely you 
used an ampersand character without intending to start an entity — escape ampersand as &amp;
    
    Escape the SSID before using it to set the label.

 panels/network/cc-wifi-connection-row.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/panels/network/cc-wifi-connection-row.c b/panels/network/cc-wifi-connection-row.c
index a4a7315ed..fdae62056 100644
--- a/panels/network/cc-wifi-connection-row.c
+++ b/panels/network/cc-wifi-connection-row.c
@@ -212,9 +212,12 @@ update_ui (CcWifiConnectionRow *self)
     }
   else
     {
+      g_autofree char *title_escaped = NULL;
+
       ssid = nm_access_point_get_ssid (best_ap);
       title = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
-      adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), title);
+      title_escaped = g_markup_escape_text (title, -1);
+      adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), title_escaped);
     }
 
   if (active_connection)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]