From efc85b2a3d8af1111fbd9004a62fb49767962538 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Wed, 25 Jun 2014 09:41:23 -0400 Subject: [PATCH] check URL for errors before attempting to download, for #207 --- openbr/plugins/misc.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/openbr/plugins/misc.cpp b/openbr/plugins/misc.cpp index 7fb257a..c7d14e9 100644 --- a/openbr/plugins/misc.cpp +++ b/openbr/plugins/misc.cpp @@ -119,17 +119,20 @@ private: } else { if (!nam.hasLocalData()) nam.setLocalData(new QNetworkAccessManager()); - QNetworkReply *reply = nam.localData()->get(QNetworkRequest(url)); - - reply->waitForReadyRead(-1); - while (!reply->isFinished()) - QCoreApplication::processEvents(); - - if (reply->error() != QNetworkReply::NoError) { - qDebug() << reply->errorString() << url; - reply->deleteLater(); - } else { - device = reply; + const QUrl qURL(url, QUrl::StrictMode); + if (qURL.isValid() && !qURL.isRelative()) { + QNetworkReply *reply = nam.localData()->get(QNetworkRequest(qURL)); + + reply->waitForReadyRead(-1); + while (!reply->isFinished()) + QCoreApplication::processEvents(); + + if (reply->error() != QNetworkReply::NoError) { + qDebug() << reply->errorString() << url; + reply->deleteLater(); + } else { + device = reply; + } } } -- libgit2 0.21.4