[gnome-software/gnome-3-26] flatpak: Do not show an error for a remote-less flatpakref application



commit dedd0b391bfb484f5ea5e6af43c79003e5338a3f
Author: Richard Hughes <richard hughsie com>
Date:   Fri Sep 8 14:03:50 2017 +0100

    flatpak: Do not show an error for a remote-less flatpakref application

 plugins/flatpak/gs-flatpak.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index c027011..52e7dc7 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1257,6 +1257,7 @@ gs_plugin_refine_item_origin_hostname (GsFlatpak *self, GsApp *app,
        g_autoptr(FlatpakRemote) xremote = NULL;
        g_autofree gchar *url = NULL;
        g_autoptr(AsProfileTask) ptask = NULL;
+       g_autoptr(GError) error_local = NULL;
 
        /* profile */
        ptask = as_profile_start (gs_plugin_get_profile (self->plugin),
@@ -1277,8 +1278,18 @@ gs_plugin_refine_item_origin_hostname (GsFlatpak *self, GsApp *app,
        xremote = flatpak_installation_get_remote_by_name (self->installation,
                                                           gs_app_get_origin (app),
                                                           cancellable,
-                                                          error);
+                                                          &error_local);
        if (xremote == NULL) {
+               if (g_error_matches (error_local,
+                                    G_IO_ERROR,
+                                    G_IO_ERROR_NOT_FOUND)) {
+                       /* if the user deletes the -origin remote for a locally
+                        * installed flatpakref file then we should just show
+                        * 'localhost' and not return an error */
+                       gs_app_set_origin_hostname (app, "");
+                       return TRUE;
+               }
+               g_propagate_error (error, g_steal_pointer (&error_local));
                gs_flatpak_error_convert (error);
                return FALSE;
        }


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