[gnome-software/960-flatpak-a-flatpakref-file-installation-fails] flatpak: A .flatpakref file installation fails



commit 1bf72e596dfcc1dc628cffeb27dba98a774d0994
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 3 12:14:51 2021 +0100

    flatpak: A .flatpakref file installation fails
    
    Use a cached GsApp only if the origin is known, the same as the GsApp
    is cached only if the origin is known, thus temporary .flatpakref
    files operate on the origin they declare.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/960

 plugins/flatpak/gs-flatpak.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index c528fb5d0..dd7f3ee20 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -337,13 +337,14 @@ gs_flatpak_create_app (GsFlatpak *self,
        /* create a temp GsApp */
        app = gs_app_new (flatpak_ref_get_name (xref));
        gs_flatpak_set_metadata (self, app, xref);
-       if (origin != NULL)
+       if (origin != NULL) {
                gs_flatpak_set_app_origin (self, app, origin, xremote, cancellable);
 
-       /* return the ref'd cached copy */
-       app_cached = gs_plugin_cache_lookup (self->plugin, gs_app_get_unique_id (app));
-       if (app_cached != NULL)
-               return app_cached;
+               /* return the ref'd cached copy, only if the origin is known */
+               app_cached = gs_plugin_cache_lookup (self->plugin, gs_app_get_unique_id (app));
+               if (app_cached != NULL)
+                       return app_cached;
+       }
 
        /* fallback values */
        if (gs_flatpak_app_get_ref_kind (app) == FLATPAK_REF_KIND_RUNTIME) {


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