kioslave: use the full path to determine the MIME type in file slave

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-04 04:14:15 +03:00
parent f34328e051
commit ee4c56ad5e

View file

@ -654,8 +654,10 @@ bool FileProtocol::createUDSEntry(const QString &filename, const QByteArray &pat
if (details > 1) {
// In real "remote" slaves, this usually depends on the protocol but not here - it can be
// determined from content, path or mode
KMimeType::Ptr mt = KMimeType::findByPath(filename, buff.st_mode);
entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, mt->name());
KMimeType::Ptr mt = KMimeType::findByPath(QFile::decodeName(path), buff.st_mode);
if (!mt.isNull()) {
entry.insert(KIO::UDSEntry::UDS_MIME_TYPE, mt->name());
}
}
if (details > 0) {