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] [Desktop Entry]
Type=MimeType Type=MimeType
MimeType=application/octet-stream MimeType=application/octet-stream
X-TDE-PatternsAccuracy=0
Comment=Unknown Comment=Unknown
Comment[af]=Onbekende Comment[af]=Onbekende
Comment[ar]=غير معروف Comment[ar]=غير معروف

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

Loading…
Cancel
Save