[tracker/tracker-0.6] Bug NB#114082 - Tracker source returns wrong metadata for attached clip with special characters
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-0.6] Bug NB#114082 - Tracker source returns wrong metadata for attached clip with special characters
- Date: Mon, 25 May 2009 06:43:50 -0400 (EDT)
commit 4ac1a7270f52c8d2c1698bfda13000abeeddb369
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon May 25 12:40:18 2009 +0200
Bug NB#114082 - Tracker source returns wrong metadata for attached clip with special characters
Replace metadata separator chars inside metadata with a similar UTF8 char.
Ideally we should be changing API to return multiple values in an array, until
then we need a way not to mistake metadata with special chars with multiple
values.
---
src/tracker-extract/tracker-escape.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/tracker-extract/tracker-escape.c b/src/tracker-extract/tracker-escape.c
index 071bd63..0048ece 100644
--- a/src/tracker-extract/tracker-escape.c
+++ b/src/tracker-extract/tracker-escape.c
@@ -32,16 +32,32 @@ gchar *
tracker_escape_metadata (const gchar *str)
{
const gchar *end;
+ gchar *copy;
if (!str) {
return NULL;
}
if (g_utf8_validate (str, -1, &end)) {
- return g_strstrip (g_strdup (str));
+ copy = g_strstrip (g_strdup (str));
+ } else {
+ copy = g_strstrip (g_strndup (str, end - str));
}
- return g_strstrip (g_strndup (str, end - str));
+ if (strchr (copy, '|') != NULL) {
+ gchar **arr;
+ gchar join_str[7] = { 0 };
+
+ /* Replace the metadata separator with a similarly looking UTF8 char */
+ g_unichar_to_utf8 (0xff5c, join_str);
+ arr = g_strsplit (copy, "|", -1);
+
+ g_free (copy);
+ copy = g_strjoinv (join_str, arr);
+ g_strfreev (arr);
+ }
+
+ return copy;
}
gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]