Browse Source

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 4 years ago
parent
commit
b0ac7d2879
2 changed files with 7 additions and 2 deletions
  1. +1
    -0
      mimetypes/application/octet-stream.desktop
  2. +6
    -2
      tdeio/tdeio/kmimetype.cpp

+ 1
- 0
mimetypes/application/octet-stream.desktop View File

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

+ 6
- 2
tdeio/tdeio/kmimetype.cpp View File

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