KMimeType::findByUrl() misdetection for "Core"

David Faure faure at
Tue Aug 18 14:33:31 BST 2009

On Sunday 05 July 2009, Andreas Pakulat wrote:
> Hi,
> for the details please have a look at:

Sent a proposal for a solution to xdg-list.

> What I'd like to know is wether an application should/can rely on
> findByUrl() doing as much as it can to properly detect the right
> mimetype. As far as I understood the API docs, this is the "catch all"
> method that one should use if there's a url. From my understanding I
> shouldn't need to care myself wether the url is local or remote and then
> also do a KMimeType::findByContent(), is that right?

Correct. It does all of this (unless disabled by fast_mode=true).

> In particular the current documentation doesn't say anything about
> the behaviour when a file has no extension, only the bugreport shows
> that in that case there are some mimetypes which are matched based on
> filename and that precedes over a content check - even for local files.

Yes, as specified by the shared-mime-info standard. I think repeating the
whole matching algorithm of the spec into the apidox for KMimeType would
be a bit overkill ;-). As far as the user of the API is concerned, it's 
supposed to just work, and if it doesn't, bug report for shared-mime-info or 
me :)

David Faure, faure at, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (, and KOffice (

More information about the kde-core-devel mailing list