Summary: | fish does not recognize all mimetypes correctly | ||
---|---|---|---|
Product: | [Unmaintained] kio | Reporter: | Ferdinand Gassauer <gassauer> |
Component: | fish | Assignee: | Jörg Walter <trouble> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Ferdinand Gassauer
2003-11-30 11:45:44 UTC
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"))) { |