Merge pull request #948 from xiaoyifang/fix/website-qt5

fix: qt5 website output response as text/plain
This commit is contained in:
xiaoyifang 2023-07-09 11:30:52 +08:00 committed by GitHub
commit 82f0f841eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,7 +92,15 @@ void IframeSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob)
buffer->setData(articleString.toUtf8()); buffer->setData(articleString.toUtf8());
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
requestJob->reply( "text/html; charset=utf-8", buffer ); requestJob->reply( "text/html; charset=utf-8", buffer );
#else
#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC )
requestJob->reply( contentType, buffer );
#else
requestJob->reply( "text/html", buffer );
#endif
#endif
}; };
connect( reply, &QNetworkReply::finished, requestJob, finishAction ); connect( reply, &QNetworkReply::finished, requestJob, finishAction );