1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

WebView: Don't try to load invalid one-word urls

And also save the host lookup in case of invalid url.
This commit is contained in:
David Rosca 2015-11-06 23:42:23 +01:00
parent fb4782dab2
commit 27f0f9afac

View File

@ -176,15 +176,18 @@ void WebView::load(const LoadRequest &request)
!reqUrl.path().contains(QL1C(' ')) &&
!reqUrl.path().contains(QL1C('.'))
) {
// FIXME: This is blocking...
QHostInfo info = QHostInfo::fromName(reqUrl.path());
QUrl u(QSL("http://") + reqUrl.path());
if (u.isValid()) {
// This is blocking...
QHostInfo info = QHostInfo::fromName(u.path());
if (info.error() == QHostInfo::NoError) {
LoadRequest req = request;
req.setUrl(QUrl(QSL("http://") + reqUrl.path()));
req.setUrl(u);
loadRequest(req);
return;
}
}
}
const LoadRequest searchRequest = mApp->searchEnginesManager()->searchResult(request.urlString());
loadRequest(searchRequest);