mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
fix: invalid bres url may cause webengine to crash. such as bres://upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif
This commit is contained in:
parent
bd6cc8b9c9
commit
3f11826918
|
@ -518,7 +518,7 @@ void ArticleView::loadFinished( bool )
|
|||
{
|
||||
setZoomFactor(cfg.preferences.zoomFactor);
|
||||
QUrl url = ui.definition->url();
|
||||
qDebug() << "article view loaded url:" << url;
|
||||
qDebug() << "article view loaded url:" << url.url ().left (200);
|
||||
|
||||
QVariant userDataVariant = ui.definition->property("currentArticle");
|
||||
|
||||
|
|
|
@ -8,16 +8,18 @@ void ResourceSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob)
|
|||
QUrl url = requestJob->requestUrl();
|
||||
|
||||
QNetworkRequest request;
|
||||
request.setUrl( url );
|
||||
|
||||
request.setUrl(url);
|
||||
QNetworkReply *reply = this->mManager.createRequest(QNetworkAccessManager::GetOperation, request, NULL);
|
||||
|
||||
connect(reply, &QNetworkReply::finished, requestJob, [=]() {
|
||||
if (reply->error() == QNetworkReply::ContentNotFoundError) {
|
||||
requestJob->fail(QWebEngineUrlRequestJob::UrlNotFound);
|
||||
return;
|
||||
}
|
||||
qDebug() << "resource scheme handler receive finished signal:" << reply->request().url();
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
qDebug() << "resource handler failed:" << reply->error() << ":" << reply->request().url();
|
||||
requestJob->fail(QWebEngineUrlRequestJob::RequestFailed);
|
||||
return;
|
||||
}
|
||||
QMimeType mineType = db.mimeTypeForUrl(url);
|
||||
QString contentType = mineType.name();
|
||||
// Reply segment
|
||||
|
|
Loading…
Reference in a new issue