I have tested the attached patch and it works :)

It's an update of the existing xdg-mime-generic-use-mimetype patch.
I'll also repost upstream.  Thank you for helping me figure this out, I
really appreciate it.
Description: Try mimetype first as the generic method for xdg-mime.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33094
Bug-Debian: http://bugs.debian.org/609630
Bug-Debian: http://bugs.debian.org/618624
Author: Per Olofsson <pe...@debian.org>
Author: Scott Ritchie <scottritc...@ubuntu.com>

Index: xdg-utils-1.1.0~rc1/scripts/xdg-mime
===================================================================
--- xdg-utils-1.1.0~rc1.orig/scripts/xdg-mime	2011-03-16 16:26:44.000000000 -0700
+++ xdg-utils-1.1.0~rc1/scripts/xdg-mime	2011-03-28 07:57:17.113065100 -0700
@@ -498,9 +498,15 @@
     if gvfs-info --help 2>/dev/null 1>&2; then
         DEBUG 1 "Running gvfs-info \"$1\""
         gvfs-info "$1" 2> /dev/null | grep standard::content-type | cut -d' ' -f4
+    elif gnomevfs-info --help 2>/dev/null 1>&2; then
+        DEBUG 1 "Running gnomevfs-info \"$1\""
+        gnomevfs-info --slow-mime "$1" 2> /dev/null | grep "^MIME" | cut -d ":" -f 2 | sed s/"^ "//
+    elif mimetype --version >/dev/null 2>&1; then
+        DEBUG 1 "Running mimetype -b \"$1\""
+        mimetype -b "$1"
     else
-       DEBUG 1 "Running gnomevfs-info \"$1\""
-       gnomevfs-info --slow-mime "$1" 2> /dev/null | grep "^MIME" | cut -d ":" -f 2 | sed s/"^ "//
+        DEBUG 1 "Running file -i \"$1\""
+        /usr/bin/file -i "$1" 2> /dev/null | cut -d ":" -f 2 | sed s/"^ "//
     fi
 
     if [ $? -eq 0 ]; then
@@ -512,8 +518,13 @@
 
 info_generic()
 {
-    DEBUG 1 "Running file -i \"$1\""
-    /usr/bin/file -i "$1" 2> /dev/null | cut -d ":" -f 2 | sed s/"^ "//
+    if mimetype --version >/dev/null 2>&1; then
+        DEBUG 1 "Running mimetype -b \"$1\""
+        mimetype -b "$1"
+    else
+        DEBUG 1 "Running file -i \"$1\""
+        /usr/bin/file -i "$1" 2> /dev/null | cut -d ":" -f 2 | sed s/"^ "//
+    fi
 
     if [ $? -eq 0 ]; then
         exit_success

Reply via email to