fix: word around to fix website return 404 with no response body

This commit is contained in:
Xiao YiFang 2022-09-16 07:54:09 +08:00
parent 3bff15f385
commit a409413f54

View file

@ -32,6 +32,11 @@ void IframeSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob)
// 404 response may have response body. // 404 response may have response body.
if( reply->error() != QNetworkReply::NoError && articleString.isEmpty()) if( reply->error() != QNetworkReply::NoError && articleString.isEmpty())
{ {
if(reply->error()==QNetworkReply::ContentNotFoundError){
//work around to fix QTBUG-106573
requestJob->redirect(url);
return;
}
QString emptyHtml = QString( "<html><body>%1</body></html>" ).arg( reply->errorString() ); QString emptyHtml = QString( "<html><body>%1</body></html>" ).arg( reply->errorString() );
buffer->setData( emptyHtml.toUtf8() ); buffer->setData( emptyHtml.toUtf8() );
requestJob->reply( contentType, buffer ); requestJob->reply( contentType, buffer );