#385085 - Support SLOW_MIME_TYPE in smb-method.c



Hi,

I just filed this:

http://bugzilla.gnome.org/show_bug.cgi?id=385085

If you have a JPEG file and rename it to "picture" (without an
extension), Nautilus can open it on a file:/// volume but not on an
smb:/// one.  This is because opening the file uses
GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE and the file method implements
that, but the SMB method doesn't.  This patch adds that support to
smb-method.

OK to commit?

  Federico
2006-12-12  Federico Mena Quintero  <federico novell com>

	Fix http://bugzilla.gnome.org/show_bug.cgi?id=385085
	(same as https://bugzilla.novell.com/show_bug.cgi?id=195269).  When
	opening SMB files with no extension or unknown extension, the
	proper MIME type doesn't get sniffed.

	* modules/smb-method.c (do_get_file_info): If we have
	GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE, then use
	gnome_vfs_get_mime_type_common() to cause the file to be sniffed.
	Otherwise, call gnome_vfs_mime_type_from_name_or_default() as
	usual.

--- gnome-vfs/modules/smb-method.c	30 May 2006 13:13:53 -0000	1.40
+++ gnome-vfs/modules/smb-method.c	12 Dec 2006 15:25:55 -0000
@@ -1855,6 +1855,8 @@ do_get_file_info (GnomeVFSMethod *method
 	if (options & GNOME_VFS_FILE_INFO_GET_MIME_TYPE) {		
 		if (S_ISDIR(st.st_mode)) {
 			mime_type = "x-directory/normal";
+		} else if (options & GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE) {
+			mime_type = gnome_vfs_get_mime_type_common (uri);
 		} else {
 			mime_type = gnome_vfs_mime_type_from_name_or_default (file_info->name, NULL);
 		}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]