mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 21:46:03 +03:00
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>
This commit is contained in:
parent
01152d3f37
commit
f39542688a
1 changed files with 3 additions and 1 deletions
|
@ -304,7 +304,9 @@ void NSISUpdater::versionInfoArrived(const UpdateInfo &info)
|
||||||
if (QFile(_targetFile).exists()) {
|
if (QFile(_targetFile).exists()) {
|
||||||
setDownloadState(DownloadComplete);
|
setDownloadState(DownloadComplete);
|
||||||
} else {
|
} 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, &QIODevice::readyRead, this, &NSISUpdater::slotWriteFile);
|
||||||
connect(reply, &QNetworkReply::finished, this, &NSISUpdater::slotDownloadFinished);
|
connect(reply, &QNetworkReply::finished, this, &NSISUpdater::slotDownloadFinished);
|
||||||
setDownloadState(Downloading);
|
setDownloadState(Downloading);
|
||||||
|
|
Loading…
Reference in a new issue