diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-09-28 23:21:12 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-09-28 23:21:12 -0400 |
commit | c0e31d17a6d3f235c8a251e851c446e00c804cdb (patch) | |
tree | cb189ee5d48c2bb8ad1a03aa540d56a4aaa43efd /src/SMAPI.Web/Controllers | |
parent | e7d29a2f7dabde75fb1ad76af1975c9194b1b8bd (diff) | |
download | SMAPI-c0e31d17a6d3f235c8a251e851c446e00c804cdb.tar.gz SMAPI-c0e31d17a6d3f235c8a251e851c446e00c804cdb.tar.bz2 SMAPI-c0e31d17a6d3f235c8a251e851c446e00c804cdb.zip |
fix handling of GitHub prerelease versions marked as non-prerelease
Diffstat (limited to 'src/SMAPI.Web/Controllers')
-rw-r--r-- | src/SMAPI.Web/Controllers/ModsApiController.cs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/SMAPI.Web/Controllers/ModsApiController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs index 401bba4f..71fb42c2 100644 --- a/src/SMAPI.Web/Controllers/ModsApiController.cs +++ b/src/SMAPI.Web/Controllers/ModsApiController.cs @@ -159,11 +159,20 @@ namespace StardewModdingAPI.Web.Controllers continue; } + // if there's only a prerelease version (e.g. from GitHub), don't override the main version + ISemanticVersion? curMain = data.Version; + ISemanticVersion? curPreview = data.PreviewVersion; + if (curPreview == null && curMain?.IsPrerelease() == true) + { + curPreview = curMain; + curMain = null; + } + // handle versions - if (this.IsNewer(data.Version, main?.Version)) - main = new ModEntryVersionModel(data.Version, data.Url!); - if (this.IsNewer(data.PreviewVersion, optional?.Version)) - optional = new ModEntryVersionModel(data.PreviewVersion, data.Url!); + if (this.IsNewer(curMain, main?.Version)) + main = new ModEntryVersionModel(curMain, data.Url!); + if (this.IsNewer(curPreview, optional?.Version)) + optional = new ModEntryVersionModel(curPreview, data.Url!); } // get unofficial version |