From c7c89a981df9bd3075340ef5b6d66dd66ca5a221 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Tue, 5 Jun 2012 10:41:42 +0200 Subject: [PATCH] url must be decode before sending the get request --- src/core/UBDownloadManager.cpp | 5 ++++- src/network/UBHttpGet.cpp | 20 -------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/core/UBDownloadManager.cpp b/src/core/UBDownloadManager.cpp index a20b0bc2..339e4caf 100644 --- a/src/core/UBDownloadManager.cpp +++ b/src/core/UBDownloadManager.cpp @@ -306,8 +306,11 @@ void UBDownloadManager::startFileDownload(sDownloadFileDesc desc) connect(http, SIGNAL(downloadProgress(int, qint64,qint64)), this, SLOT(onDownloadProgress(int,qint64,qint64))); connect(http, SIGNAL(downloadFinished(int, bool, QUrl, QString, QByteArray, QPointF, QSize, bool)), this, SLOT(onDownloadFinished(int, bool, QUrl, QString, QByteArray, QPointF, QSize, bool))); + //the desc.url is encoded. So we have to decode it before. + QUrl url; + url.setEncodedUrl(desc.url.toUtf8()); // We send here the request and store its reply in order to be able to cancel it if needed - mReplies[desc.id] = http->get(QUrl(desc.url), desc.pos, desc.size, desc.isBackground); + mReplies[desc.id] = http->get(url, desc.pos, desc.size, desc.isBackground); } /** diff --git a/src/network/UBHttpGet.cpp b/src/network/UBHttpGet.cpp index 5b513602..727c7b4e 100644 --- a/src/network/UBHttpGet.cpp +++ b/src/network/UBHttpGet.cpp @@ -65,26 +65,6 @@ QNetworkReply* UBHttpGet::get(QUrl pUrl, QPointF pPos, QSize pSize, bool isBackg return mReply; } -//QNetworkReply* UBHttpGet::get(const sDownloadFileDesc &downlinfo) -//{ -// mDownloadInfo.size = downlinfo.size; -// mDownloadInfo.isBackground = downlinfo.isBackground; -// mDownloadInfo.pos = downlinfo.pos; - -// if (mReply) -// delete mReply; - -// UBNetworkAccessManager * nam = UBNetworkAccessManager::defaultAccessManager(); -// mReply = nam->get(QNetworkRequest(QUrl(downlinfo.url))); //mReply deleted by this destructor - -// mDownloadedBytes.clear(); - -// connect(mReply, SIGNAL(finished()), this, SLOT(requestFinished())); -// connect(mReply, SIGNAL(readyRead()), this, SLOT(readyRead())); -// connect(mReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgressed(qint64, qint64))); - -// return mReply; -//} void UBHttpGet::readyRead() {