From 8d7af27e42e28fc5ebcbcf023b75444899dba2ca Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 26 Apr 2018 19:16:53 +0200 Subject: QMimeDatabase: check 128 bytes rather than 32, for text vs binary As per today's change in the MIME spec. https://bugs.freedesktop.org/show_bug.cgi?id=97372 Change-Id: Iba4fdd95c3ebec8a042404956db3466a46c97f1d Reviewed-by: Thiago Macieira --- src/corelib/mimetypes/qmimedatabase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/mimetypes') diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp index 7d529372c4..68e3c8f10d 100644 --- a/src/corelib/mimetypes/qmimedatabase.cpp +++ b/src/corelib/mimetypes/qmimedatabase.cpp @@ -311,9 +311,9 @@ static inline bool isTextFile(const QByteArray &data) if (data.startsWith(bigEndianBOM) || data.startsWith(littleEndianBOM)) return true; - // Check the first 32 bytes (see shared-mime spec) + // Check the first 128 bytes (see shared-mime spec) const char *p = data.constData(); - const char *e = p + qMin(32, data.size()); + const char *e = p + qMin(128, data.size()); for ( ; p < e; ++p) { if ((unsigned char)(*p) < 32 && *p != 9 && *p !=10 && *p != 13) return false; -- cgit v1.2.3