I checked the source for mimeTypeForUrl(). It looks correct for local files, but tries to open remote files with the same path as local files, which longs wrong to me.
Additionally, QMimeDatabase::mimeTypeForUrl() does not work with http URLs, so use mimeTypeForFileName() directly instead for remote files.
The better fix would be to really download the file to check the type, but my KIO foo is rather limited.