The info_generic function in xdg-mime looks like this:
if mimetype --version >/dev/null 2>&1; then
DEBUG 1 "Running mimetype -b \"$1\""
mimetype -b "$1"
DEBUG 1 "Running file --mime-type \"$1\""
/usr/bin/file --mime-type "$1" 2> /dev/null | cut -d ":" -f 2 | sed s/"^ "//
if [ $? -eq 0 ]; then
The problem occurs if /usr/bin/file is executed and the filename contains the colon.
Normally file outputs both the filename and the mimetype, but only the mimtype is desired so cut is employed to split the output from file into two pieces and return only the second, the mimetype.
I have not spent a lot of time trying to determine the best solution to this problem. What worked for me was to replace the whole line with:
/usr/bin/file -b --mime-type "$1" 2> /dev/null
The -b option tell file to only output the mimetype and not the filename.