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
This commit is contained in:
Matthieu Gautier 2018-11-13 15:54:09 +01:00
parent 963c0066c2
commit a478b1600c

View File

@ -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);
}