[gnome-software/155-allow-some-markup-in-release-notes-in-appdata] fwupd: Markup-escape app description



commit f714a83a45774a6f8e979a9fedb8773a01813fbb
Author: Milan Crha <mcrha redhat com>
Date:   Thu Nov 4 09:52:19 2021 +0100

    fwupd: Markup-escape app description
    
    Needed, when the description will be a markup, instead of a plain text.

 plugins/fwupd/gs-fwupd-app.c    | 6 ++++--
 plugins/fwupd/gs-plugin-fwupd.c | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/plugins/fwupd/gs-fwupd-app.c b/plugins/fwupd/gs-fwupd-app.c
index 122e11354..3cc8251a3 100644
--- a/plugins/fwupd/gs-fwupd-app.c
+++ b/plugins/fwupd/gs-fwupd-app.c
@@ -268,8 +268,10 @@ gs_fwupd_app_set_from_release (GsApp *app, FwupdRelease *rel)
        if (fwupd_release_get_description (rel) != NULL) {
                g_autofree gchar *tmp = NULL;
                tmp = as_markup_convert_simple (fwupd_release_get_description (rel), NULL);
-               if (tmp != NULL)
-                       gs_app_set_update_details (app, tmp);
+               if (tmp != NULL) {
+                       g_autofree gchar *escaped = g_markup_escape_text (tmp, -1);
+                       gs_app_set_update_details (app, escaped);
+               }
        }
 #if FWUPD_CHECK_VERSION(1,3,3)
        if (fwupd_release_get_detach_image (rel) != NULL) {
diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
index f467e9339..682329e77 100644
--- a/plugins/fwupd/gs-plugin-fwupd.c
+++ b/plugins/fwupd/gs-plugin-fwupd.c
@@ -639,8 +639,10 @@ gs_plugin_add_updates (GsPlugin *plugin,
                                                        desc);
                        }
                        if (update_desc->len > 2) {
+                               g_autofree gchar *escaped = NULL;
                                g_string_truncate (update_desc, update_desc->len - 2);
-                               gs_app_set_update_details (app, update_desc->str);
+                               escaped = g_markup_escape_text (update_desc->str, -1);
+                               gs_app_set_update_details (app, escaped);
                        }
                }
                gs_app_list_add (list, app);


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