Commit 01f78fa7 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Accept '/', '+' and '.' in key names, since gnome-vfs uses mime types as

2006-12-19  Matthias Clasen  <mclasen@redhat.com>

        * glib/gkeyfile.c (g_key_file_is_key_name): Accept
        '/', '+' and '.' in key names, since gnome-vfs uses
        mime types as keys in some cache.

2
parent 493e7ca4
2006-12-19 Matthias Clasen <mclasen@redhat.com>
* glib/gkeyfile.c (g_key_file_is_key_name): Accept
'/', '+' and '.' in key names, since gnome-vfs uses
mime types as keys in some cache.
* tests/keyfile-test.c: Tests for the above.
2006-12-18 Matthias Clasen <mclasen@redhat.com>
* configure.in: Fix the broken poll test. (#387260,
......
......@@ -3234,7 +3234,11 @@ g_key_file_is_key_name (const gchar *name)
return FALSE;
p = q = (gchar *) name;
while (*q && (g_unichar_isalnum (g_utf8_get_char (q)) || *q == '-'))
/* We accept a little more than the desktop entry spec says,
* since gnome-vfs uses mime-types as keys in its cache.
*/
while (*q && (g_unichar_isalnum (g_utf8_get_char (q)) ||
*q == '-' || *q == '_' || *q == '/' || *q == '+' || *q == '.'))
q = g_utf8_next_char (q);
if (*q == '[')
......
......@@ -1052,16 +1052,6 @@ test_key_names (void)
G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_PARSE);
/* + in key name */
data = "[a]\n"
"key+foo=123\n";
keyfile = g_key_file_new ();
g_key_file_load_from_data (keyfile, data, -1, 0, &error);
g_key_file_free (keyfile);
check_error (&error,
G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_PARSE);
/* control char in key name */
data = "[a]\n"
"key\tfoo=123\n";
......@@ -1098,15 +1088,6 @@ test_key_names (void)
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
g_key_file_free (keyfile);
keyfile = g_key_file_new ();
g_key_file_set_string (keyfile, "a", "x", "123");
g_key_file_set_string (keyfile, "a", "key+foo", "123");
value = g_key_file_get_string (keyfile, "a", "key+foo", &error);
check_error (&error,
G_KEY_FILE_ERROR,
G_KEY_FILE_ERROR_KEY_NOT_FOUND);
g_key_file_free (keyfile);
keyfile = g_key_file_new ();
g_key_file_set_string (keyfile, "a", "x", "123");
g_key_file_set_string (keyfile, "a", "key\tfoo", "123");
......@@ -1127,8 +1108,19 @@ test_key_names (void)
keyfile = g_key_file_new ();
g_key_file_set_string (keyfile, "a", "x", "123");
/* Unicode key */
g_key_file_set_string (keyfile, "a", "\xc2\xbd", "123");
check_string_value (keyfile, "a", "\xc2\xbd", "123");
/* Keys with / + . (as used by the gnome-vfs mime cache) */
g_key_file_set_string (keyfile, "a", "foo/bar", "/");
check_string_value (keyfile, "a", "foo/bar", "/");
g_key_file_set_string (keyfile, "a", "foo+bar", "+");
check_string_value (keyfile, "a", "foo+bar", "+");
g_key_file_set_string (keyfile, "a", "foo.bar", ".");
check_string_value (keyfile, "a", "foo.bar", ".");
g_key_file_free (keyfile);
}
......
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