[gnome-software] Only set the project_group when it's a valid environment ID



commit 5c56183cf78e120cf4d0d26e421a4019ddfc34f5
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jun 2 20:34:39 2017 +0100

    Only set the project_group when it's a valid environment ID
    
    We use the project_group for duplicate application filtering (for better or
    worse) so only include actual environments in this value now that appstream-glib
    no longer does this.

 plugins/core/gs-appstream.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index ceda362..d8f6557 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -544,6 +544,15 @@ gs_appstream_origin_valid (const gchar *origin)
        return TRUE;
 }
 
+static gboolean
+gs_appstream_is_valid_project_group (AsApp *item)
+{
+       const gchar *project_group = as_app_get_project_group (item);
+       if (project_group == NULL)
+               return FALSE;
+       return as_utils_is_environment_id (project_group);
+}
+
 gboolean
 gs_appstream_refine_app (GsPlugin *plugin,
                         GsApp *app,
@@ -730,8 +739,8 @@ gs_appstream_refine_app (GsPlugin *plugin,
        }
 
        /* set project group */
-       if (as_app_get_project_group (item) != NULL &&
-           gs_app_get_project_group (app) == NULL)
+       if (gs_app_get_project_group (app) == NULL &&
+           gs_appstream_is_valid_project_group (item))
                gs_app_set_project_group (app, as_app_get_project_group (item));
 
        /* set developer name */


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