Version: unknown (using KDE 3.1.93 (CVS >= 20031111), compiled sources) Compiler: gcc version 3.3.1 (SuSE Linux) OS: Linux (i686) release 2.4.21-144-default kwd is reproted to be a zip file - which is true but not what I expect doc and xls are reported to be Microsoft Word documents pdf and ps are reported correctly Nicolas Goutte <nicolasg@snafu.de> It looks like only the file content is checked and not the extension anymore. Which KDE? Does it happen only for fish? ("Microsoft Word" in this context only means OLE file. However the extension doc is used for many file types so it cannot be used to tell this is a MS Word file.) Stephan Kulow <coolo@kde.org> fish calls file(1) for the files, and that one got no concept of our mimetypes cu
CVS commit by faure: Fixed mimetype determination for kio_fish: look at extension first, and fallback to what file(1) says only if the extension is unknown; this is pretty much what we do for local files too. BUG: 69333 About #69161: I guess this means we could somehow avoid the file(1) call when we know the extension, for better performance? CCBUG: 69161 M +9 -1 fish.cpp 1.62 --- kdebase/kioslave/fish/fish.cpp #1.61:1.62 @@ -74,4 +74,5 @@ #include <time.h> #include <sys/stat.h> +#include <kmimetype.h> #include <kmimemagic.h> #include <fcntl.h> @@ -935,4 +936,11 @@ void fishProtocol::manageConnection(cons if (fishCommand == FISH_LIST) udsEntry.append(atom); + // By default, the mimetype comes from the extension + // We'll use the file(1) result only as fallback [like the rest of KDE does] + { + KMimeType::Ptr mime = KMimeType::findByURL( KURL("fish://host/" + thisFn) ); + if ( mime->name() != KMimeType::defaultMimeType() ) + mimeAtom.m_str = mime->name(); + } errorCount--; break; @@ -941,5 +949,5 @@ void fishProtocol::manageConnection(cons // This is getting ugly. file(1) makes some uneducated // guesses, so we must try to ignore them (#51274) - if (line.right(8) != "/unknown" && + if (mimeAtom.m_str.isEmpty() && line.right(8) != "/unknown" && (thisFn.find('.') < 0 || (line.left(8) != "Mtext/x-" && line != "Mtext/plain"))) {