[tracker/handle-desktop-links] tracker-miner-fs: Check URL is provided for desktop file Type=Link
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/handle-desktop-links] tracker-miner-fs: Check URL is provided for desktop file Type=Link
- Date: Thu, 1 Sep 2011 15:40:18 +0000 (UTC)
commit 41f482e21507fe501ab619000ffc38c04e1beb8d
Author: Martyn Russell <martyn lanedo com>
Date: Thu Sep 1 16:38:56 2011 +0100
tracker-miner-fs: Check URL is provided for desktop file Type=Link
Also free the url after use.
src/miners/fs/tracker-miner-applications.c | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-applications.c b/src/miners/fs/tracker-miner-applications.c
index 56d4749..98b36cd 100644
--- a/src/miners/fs/tracker-miner-applications.c
+++ b/src/miners/fs/tracker-miner-applications.c
@@ -512,20 +512,27 @@ process_desktop_file (ProcessApplicationData *data,
} else if (name && g_ascii_strcasecmp (type, "Link") == 0) {
gchar *url = g_key_file_get_string (key_file, GROUP_DESKTOP_ENTRY, "URL", NULL);
- uri = g_file_get_uri (data->file);
- tracker_sparql_builder_insert_silent_open (sparql, TRACKER_MINER_FS_GRAPH_URN);
+ if (url) {
+ uri = g_file_get_uri (data->file);
+ tracker_sparql_builder_insert_silent_open (sparql, TRACKER_MINER_FS_GRAPH_URN);
- tracker_sparql_builder_subject_iri (sparql, uri);
- tracker_sparql_builder_predicate (sparql, "a");
- tracker_sparql_builder_object (sparql, "nfo:Bookmark");
+ tracker_sparql_builder_subject_iri (sparql, uri);
+ tracker_sparql_builder_predicate (sparql, "a");
+ tracker_sparql_builder_object (sparql, "nfo:Bookmark");
- tracker_sparql_builder_predicate (sparql, "nfo:bookmarks");
- tracker_sparql_builder_object_iri (sparql, url);
+ tracker_sparql_builder_predicate (sparql, "nfo:bookmarks");
+ tracker_sparql_builder_object_iri (sparql, url);
- tracker_sparql_builder_predicate (sparql, "nie:dataSource");
- tracker_sparql_builder_object_iri (sparql, APPLICATION_DATASOURCE_URN);
+ tracker_sparql_builder_predicate (sparql, "nie:dataSource");
+ tracker_sparql_builder_object_iri (sparql, APPLICATION_DATASOURCE_URN);
- is_software = FALSE;
+ is_software = FALSE;
+
+ g_free (url);
+ } else {
+ g_warning ("Invalid desktop file: '%s'", uri);
+ g_warning (" Type 'Link' requires a URL");
+ }
#ifdef HAVE_MEEGOTOUCH
} else if (name && g_ascii_strcasecmp (type, "ControlPanelApplet") == 0) {
/* Special case control panel applets */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]