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>
pull/1/head
Slávek Banko 9 years ago
parent 075cf11458
commit b0ac7d2879

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

@ -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;
}
}
}
}

Loading…
Cancel
Save