Commit 2eda05bb authored by Sam Thursfield's avatar Sam Thursfield

Merge branch 'sam/text-extractor-errors' into 'master'

tracker-extract-text: Correctly report errors back to the caller

Closes #56

See merge request !62
parents 13948fda 08f4af62
Pipeline #78944 passed with stage
in 1 minute and 14 seconds
......@@ -46,10 +46,7 @@ get_file_content (GFile *file,
gchar *text, *uri, *path;
int fd;
/* If no content requested, return */
if (n_bytes == 0) {
return NULL;
}
g_return_val_if_fail (n_bytes > 0, NULL);
uri = g_file_get_uri (file);
......@@ -85,12 +82,20 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
{
TrackerResource *metadata;
TrackerConfig *config;
gchar *content;
gsize n_bytes;
gchar *content = NULL;
config = tracker_main_get_config ();
content = get_file_content (tracker_extract_info_get_file (info),
tracker_config_get_max_bytes (config));
n_bytes = tracker_config_get_max_bytes (config);
if (n_bytes > 0) {
content = get_file_content (tracker_extract_info_get_file (info), n_bytes);
if (content == NULL) {
/* An error occurred, perhaps the file was deleted. */
return FALSE;
}
}
metadata = tracker_resource_new (NULL);
tracker_resource_add_uri (metadata, "rdf:type", "nfo:PlainTextDocument");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment