[gnome-software/wip/kalev/issue459: 1/2] flatpak: Don't try to download non-flatpak apps



commit b92756d97de779f45d718deb889c60c1db75cd97
Author: Kalev Lember <klember redhat com>
Date:   Sun Sep 23 09:35:40 2018 +0200

    flatpak: Don't try to download non-flatpak apps
    
    When handling gs_plugin_download(), build a list of flatpak apps up
    front so that we don't accidentally try to download any non-flatpak apps
    later (and fail horribly).
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/459

 plugins/flatpak/gs-plugin-flatpak.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 0e4a1c15..4aedd182 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -455,13 +455,14 @@ gs_plugin_download (GsPlugin *plugin, GsAppList *list,
 {
        GsFlatpak *flatpak = NULL;
        g_autoptr(FlatpakTransaction) transaction = NULL;
+       g_autoptr(GsAppList) list_tmp = gs_app_list_new ();
 
        /* not supported */
        for (guint i = 0; i < gs_app_list_length (list); i++) {
                GsApp *app = gs_app_list_index (list, i);
                flatpak = gs_plugin_flatpak_get_handler (plugin, app);
                if (flatpak != NULL)
-                       break;
+                       gs_app_list_add (list_tmp, app);
        }
        if (flatpak == NULL)
                return TRUE;
@@ -473,8 +474,8 @@ gs_plugin_download (GsPlugin *plugin, GsAppList *list,
                return FALSE;
        }
        flatpak_transaction_set_no_deploy (transaction, TRUE);
-       for (guint i = 0; i < gs_app_list_length (list); i++) {
-               GsApp *app = gs_app_list_index (list, i);
+       for (guint i = 0; i < gs_app_list_length (list_tmp); i++) {
+               GsApp *app = gs_app_list_index (list_tmp, i);
                g_autofree gchar *ref = NULL;
 
                ref = gs_flatpak_app_get_ref_display (app);


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