app: gimp_data_create_filename(): avoid evil characters in the filename

such as forbidden ones on various platforms. List collected on #gimp
with a fair portion of paranoia involved.
This commit is contained in:
Michael Natterer 2011-04-13 21:25:10 +02:00
parent f1c20cb165
commit ede0d26b91
1 changed files with 3 additions and 1 deletions

View File

@ -791,11 +791,13 @@ gimp_data_create_filename (GimpData *data,
return;
}
g_strstrip (safename);
if (safename[0] == '.')
safename[0] = '-';
for (i = 0; safename[i]; i++)
if (safename[i] == G_DIR_SEPARATOR || g_ascii_isspace (safename[i]))
if (strchr ("\\/*?\"`'<>{}|\n\t ;:$^&", safename[i]))
safename[i] = '-';
filename = g_strconcat (safename, gimp_data_get_extension (data), NULL);