facfeb6
From e04f8065335e391f47b04513d395e02a7f13d56e Mon Sep 17 00:00:00 2001
facfeb6
From: Lionel Orry <lionel.orry@gmail.com>
facfeb6
Date: Wed, 13 Aug 2014 09:56:25 +0200
facfeb6
Subject: [PATCH 10/11] xdg-mime: do not report multiple desktop files
facfeb6
 (BR60329)
facfeb6
facfeb6
since commit 050333e3, xdg-mime checks both defaults.list and
facfeb6
mimeinfo.cache. When a result is present in both files, it returns both
facfeb6
results separated by a space.
facfeb6
facfeb6
When this is the case, the desktop file name is made of the duplicated
facfeb6
filename and the following chain of executions does not work properly.
facfeb6
facfeb6
This commit tries to select the first found line before extracting the
facfeb6
desktop file name.
facfeb6
facfeb6
Signed-off-by: Lionel Orry <lionel.orry@gmail.com>
facfeb6
---
facfeb6
 scripts/xdg-mime.in | 2 +-
facfeb6
 1 file changed, 1 insertion(+), 1 deletion(-)
facfeb6
facfeb6
diff --git a/scripts/xdg-mime.in b/scripts/xdg-mime.in
facfeb6
index 80781c8..74cadfa 100644
facfeb6
--- a/scripts/xdg-mime.in
facfeb6
+++ b/scripts/xdg-mime.in
facfeb6
@@ -383,7 +383,7 @@ defapp_generic()
facfeb6
     for x in `echo "$xdg_system_dirs" | sed 's/:/ /g'`; do
facfeb6
        for prefix in "$XDG_MENU_PREFIX" ""; do
facfeb6
           DEBUG 2 "Checking $x/applications/${prefix}defaults.list and $x/applications/${prefix}mimeinfo.cache"
facfeb6
-          trader_result=`grep "$MIME=" $x/applications/${prefix}defaults.list $x/applications/${prefix}mimeinfo.cache 2> /dev/null | cut -d '=' -f 2 | cut -d ';' -f 1`
facfeb6
+          trader_result=`grep "$MIME=" $x/applications/${prefix}defaults.list $x/applications/${prefix}mimeinfo.cache 2> /dev/null | head -n 1 | cut -d '=' -f 2 | cut -d ';' -f 1`
facfeb6
           if [ -n "$trader_result" ] ; then
facfeb6
               echo $trader_result
facfeb6
               exit_success
facfeb6
-- 
facfeb6
2.1.0
facfeb6