mirror of
https://github.com/Pathoschild/SMAPI.git
synced 2026-10-12 02:08:51 +00:00
add workaround for CurseForge prerelease version auto-sync issue
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
* For the update check server:
|
||||
* Rewrote update checks for mods on CurseForge and ModDrop to use new export API endpoints.
|
||||
_This should result in much faster update checks for those sites, and less chance of update-check errors when their servers are under heavy load._
|
||||
* Added workaround for CurseForge auto-syncing prerelease versions with an invalid version number.
|
||||
|
||||
* For the log parser:
|
||||
* Clicking a checkbox in the mod list now always only changes that checkbox, to allow hiding a single mod.
|
||||
|
||||
@@ -181,13 +181,29 @@ namespace StardewModdingAPI.Web.Framework.Clients.CurseForge
|
||||
/// <param name="fileName">The file's internal name.</param>
|
||||
private string? GetRawVersion(string? displayName, string? fileName)
|
||||
{
|
||||
// get raw version
|
||||
Match match = this.VersionInNamePattern.Match(displayName ?? "");
|
||||
if (!match.Success)
|
||||
match = this.VersionInNamePattern.Match(fileName ?? "");
|
||||
if (!match.Success)
|
||||
return null;
|
||||
|
||||
return match.Success
|
||||
? match.Groups[1].Value
|
||||
: null;
|
||||
// fix auto-synced prerelease versions having a double version in the name (like "2.4.0-alpha.20240818-2-4-0-alpha-20240818")
|
||||
string version = match.Groups[1].Value;
|
||||
if (version.Length > 2 && version.Length % 2 == 1)
|
||||
{
|
||||
int splitIndex = version.Length / 2;
|
||||
if (version[splitIndex] == '-')
|
||||
{
|
||||
string left = version[..splitIndex];
|
||||
string right = version[(splitIndex + 1)..];
|
||||
|
||||
if (left.Replace('.', '-') == right)
|
||||
version = left;
|
||||
}
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
/// <summary>Get the full mod page URL for a given ID.</summary>
|
||||
|
||||
Reference in New Issue
Block a user