Fix mimetype detection using magic library

for mime types not contained in TDE settings
This resolves Bug 2392

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit b0ac7d2879)
v3.5.13-sru
Slávek Banko 9 years ago
parent dab5e4adcb
commit b334cc03d5

@ -221,8 +221,12 @@ KMimeType::Ptr KMimeType::findByURL( const KURL& _url, mode_t _mode,
KMimeMagicResult* result =
KMimeMagic::self()->findFileType( path );
if ( result && result->isValid() && result->accuracy() > 0 )
return mimeType( result->mimeType() );
if ( result && result->isValid() && result->accuracy() > 0 ) {
KMimeType::Ptr resultMime = mimeType( result->mimeType() );
if (resultMime->patternsAccuracy() > 0) {
return resultMime;
}
}
}
}

@ -1,6 +1,7 @@
[Desktop Entry]
Type=MimeType
MimeType=application/octet-stream
X-KDE-PatternsAccuracy=0
Comment=Unknown
Comment[af]=Onbekende
Comment[ar]=غير معروف

Loading…
Cancel
Save