[gnome-software] Show a warning when more than one app matches a wildcard
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Show a warning when more than one app matches a wildcard
- Date: Fri, 27 May 2016 07:17:43 +0000 (UTC)
commit 8a44990e1ce3ec94a293a62c6535871c52d3eafc
Author: Richard Hughes <richard hughsie com>
Date: Thu May 26 19:09:27 2016 +0100
Show a warning when more than one app matches a wildcard
src/plugins/gs-plugin-appstream.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index bef69b8..6c30270 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -238,6 +238,7 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
/* find the best app when matching any prefixes */
if (gs_app_has_quirk (app, AS_APP_QUIRK_MATCH_ANY_PREFIX)) {
g_autoptr(GPtrArray) items = NULL;
+
items = as_store_get_apps_by_id (priv->store, id);
for (i = 0; i < items->len; i++) {
AsApp *item_tmp = NULL;
@@ -252,10 +253,20 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
continue;
}
- /* we could match more than one, so list all and return
- * the last entry -- fingers crossed it's only one... */
+
+ /* already set! */
+ if (item != NULL) {
+ g_warning ("found duplicate %s for wildcard %s",
+ as_app_get_id (item_tmp),
+ id);
+ continue;
+ }
+
+ /* only match the first entry */
g_debug ("found %s for wildcard %s",
as_app_get_id (item_tmp), id);
+
+ /* refine using this */
item = item_tmp;
}
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]