summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-05-17 19:27:16 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-05-17 19:27:16 -0400
commit8e2d8b97f047e6d79a3e424ba0dc611388cb65cd (patch)
tree94631f33593d0a4417dd7a6f8dd54b31a9a01460 /src/SMAPI.Web/Framework
parent4eebd813f239267d659f3cbf4fa6cf5d47d99c26 (diff)
downloadSMAPI-8e2d8b97f047e6d79a3e424ba0dc611388cb65cd.tar.gz
SMAPI-8e2d8b97f047e6d79a3e424ba0dc611388cb65cd.tar.bz2
SMAPI-8e2d8b97f047e6d79a3e424ba0dc611388cb65cd.zip
fix mod update checks failing if a mod only has prerelease versions on GitHub
Diffstat (limited to 'src/SMAPI.Web/Framework')
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs b/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs
index b12b24e2..f4abd379 100644
--- a/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs
+++ b/src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs
@@ -38,21 +38,25 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
// fetch info
try
{
- // get latest release
+ // get latest release (whether preview or stable)
GitRelease latest = await this.Client.GetLatestReleaseAsync(id, includePrerelease: true);
- GitRelease preview = null;
if (latest == null)
return new ModInfoModel("Found no mod with this ID.");
- // get latest stable release (if not latest)
+ // split stable/prerelease if applicable
+ GitRelease preview = null;
if (latest.IsPrerelease)
{
- preview = latest;
- latest = await this.Client.GetLatestReleaseAsync(id, includePrerelease: false);
+ GitRelease result = await this.Client.GetLatestReleaseAsync(id, includePrerelease: false);
+ if (result != null)
+ {
+ preview = latest;
+ latest = result;
+ }
}
// return data
- return new ModInfoModel(name: id, version: this.NormaliseVersion(latest?.Tag), previewVersion: this.NormaliseVersion(preview?.Tag), url: $"https://github.com/{id}/releases");
+ return new ModInfoModel(name: id, version: this.NormaliseVersion(latest.Tag), previewVersion: this.NormaliseVersion(preview?.Tag), url: $"https://github.com/{id}/releases");
}
catch (Exception ex)
{