From a478b1600ce177fe3b42005c227b6b612dd7d2d5 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 13 Nov 2018 15:54:09 +0100 Subject: [PATCH] Workaroud the contentType handling of QTWebEngine. It seems that QTWebEngine doesn't correctly handle a "complex" mimeType (`text/html; charset=utf-8`). In this case, it handles the content as `plain/text`. So let pass only the first part of the full mimeType without the charset. Fix #50 --- src/urlschemehandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/urlschemehandler.cpp b/src/urlschemehandler.cpp index d2c2677..a8c4461 100644 --- a/src/urlschemehandler.cpp +++ b/src/urlschemehandler.cpp @@ -47,6 +47,7 @@ UrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *request) } BlobBuffer* buffer = new BlobBuffer(entry.getBlob()); auto mimeType = QByteArray::fromStdString(entry.getMimetype()); + mimeType = mimeType.split(';')[0]; connect(buffer, &QIODevice::aboutToClose, buffer, &QObject::deleteLater); request->reply(mimeType, buffer); }