Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@nextcloud.com>2020-10-05 16:48:39 +0300
committerKevin Ottens <kevin.ottens@nextcloud.com>2020-10-05 16:48:39 +0300
commitf39542688a2536a8f4645c84909c2bdee002d7a9 (patch)
tree8fc82a9e6719866184179e1805366cecca7994df /src/gui/updater
parent01152d3f37beedea2c0433ee8eb9c8be66d3cfd3 (diff)
Handle redirects when downloading updates
This is necessary for downloads coming from Github for instance. They are systematically redirected and we'd just fail the download. Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Diffstat (limited to 'src/gui/updater')
-rw-r--r--src/gui/updater/ocupdater.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp
index 66528f8dc..3f772ef01 100644
--- a/src/gui/updater/ocupdater.cpp
+++ b/src/gui/updater/ocupdater.cpp
@@ -304,7 +304,9 @@ void NSISUpdater::versionInfoArrived(const UpdateInfo &info)
if (QFile(_targetFile).exists()) {
setDownloadState(DownloadComplete);
} else {
- QNetworkReply *reply = qnam()->get(QNetworkRequest(QUrl(url)));
+ auto request = QNetworkRequest(QUrl(url));
+ request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
+ QNetworkReply *reply = qnam()->get(request);
connect(reply, &QIODevice::readyRead, this, &NSISUpdater::slotWriteFile);
connect(reply, &QNetworkReply::finished, this, &NSISUpdater::slotDownloadFinished);
setDownloadState(Downloading);