summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-09-28 23:21:12 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-09-28 23:21:12 -0400
commitc0e31d17a6d3f235c8a251e851c446e00c804cdb (patch)
treecb189ee5d48c2bb8ad1a03aa540d56a4aaa43efd
parente7d29a2f7dabde75fb1ad76af1975c9194b1b8bd (diff)
downloadSMAPI-c0e31d17a6d3f235c8a251e851c446e00c804cdb.tar.gz
SMAPI-c0e31d17a6d3f235c8a251e851c446e00c804cdb.tar.bz2
SMAPI-c0e31d17a6d3f235c8a251e851c446e00c804cdb.zip
fix handling of GitHub prerelease versions marked as non-prerelease
-rw-r--r--docs/release-notes.md4
-rw-r--r--src/SMAPI.Web/Controllers/ModsApiController.cs17
2 files changed, 17 insertions, 4 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index ab23b46e..ea459bcb 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -7,6 +7,10 @@
_If needed, you can update to SMAPI 3.16.0 first and then install the latest version._
-->
+## Upcoming release
+* For players:
+ * Fixed update alert shown for a prerelease version on GitHub if it's not marked as prerelease.
+
## 3.16.2
Released 31 August 2022 for Stardew Valley 1.5.6 or later.
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