mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
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 svn path=/trunk/; revision=7491
This commit is contained in:
parent
4b92cd39fd
commit
f634171ec5
@ -1,3 +1,11 @@
|
||||
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 ()
|
||||
|
@ -895,10 +895,19 @@ g_content_type_guess (const char *filename,
|
||||
|
||||
if (filename)
|
||||
{
|
||||
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. */
|
||||
if (n_name_mimetypes == 1)
|
||||
|
Loading…
Reference in New Issue
Block a user