[gnome-software] Don't explode when using metadata with 'type=font'
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Don't explode when using metadata with 'type=font'
- Date: Wed, 18 Sep 2013 15:07:54 +0000 (UTC)
commit 221cd1ca4d0a8c1a9d137ea16e7241e037ddce0a
Author: Richard Hughes <richard hughsie com>
Date: Wed Sep 18 16:07:39 2013 +0100
Don't explode when using metadata with 'type=font'
src/plugins/appstream-app.c | 6 ++++++
src/plugins/appstream-cache.c | 9 +--------
2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/appstream-app.c b/src/plugins/appstream-app.c
index a4cf15e..36c0127 100644
--- a/src/plugins/appstream-app.c
+++ b/src/plugins/appstream-app.c
@@ -225,7 +225,13 @@ appstream_app_set_id (AppstreamApp *app,
const gchar *id,
gsize length)
{
+ gchar *tmp;
app->id = g_strndup (id, length);
+
+ /* trim the extension as we only use the short form here */
+ tmp = g_strrstr (app->id, ".");
+ if (tmp != NULL)
+ *tmp = '\0';
}
/**
diff --git a/src/plugins/appstream-cache.c b/src/plugins/appstream-cache.c
index 8f3d9a4..e114a5b 100644
--- a/src/plugins/appstream-cache.c
+++ b/src/plugins/appstream-cache.c
@@ -415,14 +415,7 @@ appstream_cache_text_cb (GMarkupParseContext *context,
"item_temp id invalid");
return;
}
- if (text_len < 9) {
- g_set_error_literal (error,
- APPSTREAM_CACHE_ERROR,
- APPSTREAM_CACHE_ERROR_FAILED,
- "desktop id invalid");
- return;
- }
- appstream_app_set_id (helper->item_temp, text, text_len - 8);
+ appstream_app_set_id (helper->item_temp, text, text_len);
break;
case APPSTREAM_CACHE_SECTION_PKGNAME:
if (helper->item_temp == NULL ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]