summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoaquim Rocha <jrocha@endlessm.com>2017-09-06 12:37:47 +0200
committerJoaquim Rocha <jrocha@endlessm.com>2017-09-06 12:52:05 +0200
commit1ac8983af3b264cb913fc79997d668f43eb015ab (patch)
tree37cec6382ec19a2f2c747de5c2c364648313a5cf
parentb3abcb09ac39400afcabfa68789d3216d6890e85 (diff)
downloadappstream-glib-1ac8983af3b264cb913fc79997d668f43eb015ab.tar.gz
Do not assign "flatpak" as an app's origin when no origin was found
This fallback mechanism is useful when it comes to PackageKit type apps, but for Flatpak ones will result in GNOME Software trying to look for a remote called "flatpak" and: 1) if it exists, the app is associated with it erroneously, or 2) if it doesn't exist, an error banner will be shown in the UI.
-rw-r--r--libappstream-glib/as-store.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libappstream-glib/as-store.c b/libappstream-glib/as-store.c
index b340f24..12dd8de 100644
--- a/libappstream-glib/as-store.c
+++ b/libappstream-glib/as-store.c
@@ -1416,6 +1416,7 @@ as_store_from_root (AsStore *store,
g_autoptr(AsProfileTask) ptask = NULL;
g_autoptr(AsRefString) icon_path_str = NULL;
g_autoptr(AsRefString) origin_str = NULL;
+ gboolean origin_is_flatpak;
g_return_val_if_fail (AS_IS_STORE (store), FALSE);
@@ -1468,9 +1469,11 @@ as_store_from_root (AsStore *store,
}
}
+ origin_is_flatpak = g_strcmp0 (priv->origin, "flatpak") == 0;
+
/* special case flatpak symlinks -- scope:name.xml.gz */
if (origin_app == NULL &&
- g_strcmp0 (priv->origin, "flatpak") == 0 &&
+ origin_is_flatpak &&
source_filename != NULL &&
g_file_test (source_filename, G_FILE_TEST_IS_SYMLINK)) {
g_autofree gchar *source_basename = NULL;
@@ -1497,7 +1500,7 @@ as_store_from_root (AsStore *store,
}
/* fallback */
- if (origin_app == NULL) {
+ if (origin_app == NULL && !origin_is_flatpak) {
id_prefix_app = g_strdup (as_app_scope_to_string (scope));
origin_app = g_strdup (priv->origin);
origin_app_icons = g_strdup (priv->origin);