+2008-09-15 Matthias Clasen <mclasen@redhat.com>
+
+ Bug 551681 – g_content_type_guess() too naive with filenames
+
+ * gcontenttype.c (g_content_type_guess): Check whether there's a '/'
+ at the end of the filename, and declare it a directory.
+ Patch by Bastien Nocera
+
2008-09-14 Cosimo Cecchi <cosimoc@gnome.org>
Bug 551887 – Docs for g_desktop_app_info_new_from_filename ()
if (filename)
{
- basename = g_path_get_basename (filename);
- n_name_mimetypes = xdg_mime_get_mime_types_from_file_name (basename, name_mimetypes, 10);
- g_free (basename);
+ i = strlen (filename);
+ if (filename[i - 1] == '/') {
+ char *mimetypes[] = { "inode/directory", NULL };
+ name_mimetypes = g_strdupv (mimetypes);
+ n_name_mimetypes = 1;
+ if (result_uncertain)
+ *result_uncertain = TRUE;
+ } else {
+ basename = g_path_get_basename (filename);
+ n_name_mimetypes = xdg_mime_get_mime_types_from_file_name (basename, name_mimetypes, 10);
+ g_free (basename);
+ }
}
/* Got an extension match, and no conflicts. This is it. */