Skip to content

Commit

Permalink
Check download name instead of index
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Dec 21, 2017
1 parent 19328d4 commit 050acdb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Core/Net/AutoUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,17 @@ public void FetchLatestReleaseInfo()
{
fetchedCkanUrl = RetrieveUrl(response, 0);
// Check whether the release includes the auto updater
if (response.assets.Count >= 4) {
// Last asset is AutoUpdater.exe
fetchedUpdaterUrl = RetrieveUrl(response, 3);
} else {
foreach (var asset in response.assets)
{
string url = asset.browser_download_url.ToString();
if (url.EndsWith("AutoUpdater.exe"))
{
fetchedUpdaterUrl = new Tuple<Uri, long>(new Uri(url), (long)asset.size);
break;
}
}
if (fetchedUpdaterUrl == null)
{
// Older releases don't include the auto updater
fetchedUpdaterUrl = RetrieveUrl(MakeRequest(oldLatestUpdaterReleaseApiUrl), 0);
}
Expand Down

0 comments on commit 050acdb

Please sign in to comment.