Skip to content

Commit

Permalink
Fix wrong installer downloaded on x86 (fix #1608)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Mar 31, 2019
1 parent 878e0b8 commit 0af2388
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/src/updater/program-updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,19 @@ void ProgramUpdater::downloadUpdate()
{
QJsonDocument json = QJsonDocument::fromJson(m_source);
QJsonObject lastRelease = json.object();
QJsonObject lastAsset = lastRelease["assets"].toArray().first().toObject();
QJsonArray lastAssets = lastRelease["assets"].toArray();
QJsonObject lastAsset;
for (int i = 0; i < lastAssets.size(); ++i) {
const QJsonObject obj = lastAssets[i].toObject();
const QString name = obj["name"].toString();
if (name.endsWith(".exe") && name.contains(VERSION_PLATFORM)) {
lastAsset = obj;
}
}
if (lastAsset.isEmpty()) {
log("No proper release asset found for updatind", Logger::Error);
return;
}

QUrl url(lastAsset["browser_download_url"].toString());
m_updateFilename = url.fileName();
Expand Down

0 comments on commit 0af2388

Please sign in to comment.