GNOME Bugzilla – Bug 442792
ignores tags with trailing spaces
Last modified: 2007-06-03 02:32:06 UTC
The code that tries to detect duplicate (id3v2 vs id3v1) tags causes tags with trailing whitespace to be ignored altogether. When importing files with such tags, I see this in the debug output: (15:49:06) [0x805fff8] [rb_metadata_gst_load_tag] rb-metadata-gst.c:595: uri: file:///space/music/The_Orb/Bicycles_%26_Tricycles_/08_L.U.C.A..ogg tag: album (15:49:06) [0x805fff8] [rb_metadata_gst_load_tag] rb-metadata-gst.c:645: Got shorter duplicate tag and the album tag for all files in that album is ignored. These files only have one album tag.
This isn't normal, and I don't see we'd be doing that in the code. Any ideas? case G_TYPE_STRING: { /* Reject invalid utf-8 strings, shorter duplicated tags * and then remove leading and trailing whitespace. */ char *str; const char *old_str; str = g_value_dup_string (newval); if (!g_utf8_validate (str, -1, NULL)) { rb_debug ("Got invalid UTF-8 tag data"); g_free (str); g_value_unset (newval); g_free (newval); return; } str = g_strstrip (str); /* Check whether we have a shorter duplicate tag, * Doesn't work with non-normalised UTF-8 strings */ old_str = g_value_get_string (val); if (old_str != NULL && g_utf8_strlen (old_str, -1) > g_utf8_strlen (str, -1)) { if (g_str_has_prefix (old_str, str) != FALSE) { rb_debug ("Got shorter duplicate tag"); g_free (str); g_value_unset (newval); g_free (newval); return; } } g_value_take_string (newval, str); break;
'val' and 'newval' are both copies of the string from the incoming tag list, so 'str' is the whitespace-stripped version and 'old_str' is the original. We'd need to find the existing value from the md->priv->metadata hash table to compare the incoming value against any existing value.
Created attachment 89265 [details] [review] patch
Looks okay to me
committed to trunk and stable.