summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2015-12-06 16:00:18 +0100
committerSlávek Banko <slavek.banko@axis.cz>2015-12-06 16:00:18 +0100
commitb0ac7d287922e883a2e571222089b680adfe46c6 (patch)
tree9b252a7b13f1f37f6187911452fc70429b1c79b7
parent075cf11458a98245a47505b944c5606c1b86afb2 (diff)
downloadtdelibs-b0ac7d287922e883a2e571222089b680adfe46c6.tar.gz
tdelibs-b0ac7d287922e883a2e571222089b680adfe46c6.zip
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>
-rw-r--r--mimetypes/application/octet-stream.desktop1
-rw-r--r--tdeio/tdeio/kmimetype.cpp8
2 files changed, 7 insertions, 2 deletions
diff --git a/mimetypes/application/octet-stream.desktop b/mimetypes/application/octet-stream.desktop
index 3b2859890..72a60bc3b 100644
--- a/mimetypes/application/octet-stream.desktop
+++ b/mimetypes/application/octet-stream.desktop
@@ -1,6 +1,7 @@
[Desktop Entry]
Type=MimeType
MimeType=application/octet-stream
+X-TDE-PatternsAccuracy=0
Comment=Unknown
Comment[af]=Onbekende
Comment[ar]=غير معروف
diff --git a/tdeio/tdeio/kmimetype.cpp b/tdeio/tdeio/kmimetype.cpp
index d1bd940eb..197670916 100644
--- a/tdeio/tdeio/kmimetype.cpp
+++ b/tdeio/tdeio/kmimetype.cpp
@@ -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;
+ }
+ }
}
}