[gnome-software/1268-appstream-urls-not-properly-supported: 3/5] snap: Handle also appstream:// URL-s in url-to-app




commit 6808f6a728c9a81ad081e92008f652c45031d9cd
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jul 29 14:04:30 2021 +0200

    snap: Handle also appstream:// URL-s in url-to-app
    
    The applications are referenced by the ID in the appstream:// URL,
    by which the snap can search for too.

 plugins/snap/gs-plugin-snap.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 6cbab2ef2..d500cd41d 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -368,12 +368,18 @@ gs_plugin_url_to_app (GsPlugin *plugin,
 
        /* not us */
        scheme = gs_utils_get_url_scheme (url);
-       if (g_strcmp0 (scheme, "snap") != 0)
+       if (g_strcmp0 (scheme, "snap") != 0 &&
+           g_strcmp0 (scheme, "appstream") != 0)
                return TRUE;
 
        /* create app */
        path = gs_utils_get_url_path (url);
        snaps = find_snaps (plugin, SNAPD_FIND_FLAGS_SCOPE_WIDE | SNAPD_FIND_FLAGS_MATCH_NAME, NULL, path, 
cancellable, NULL);
+       if (snaps == NULL || snaps->len < 1) {
+               g_clear_pointer (&snaps, g_ptr_array_unref);
+               /* This works for the appstream:// URL-s */
+               snaps = find_snaps (plugin, SNAPD_FIND_FLAGS_SCOPE_WIDE | SNAPD_FIND_FLAGS_MATCH_COMMON_ID, 
NULL, path, cancellable, NULL);
+       }
        if (snaps == NULL || snaps->len < 1)
                return TRUE;
 


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