handle common 'v' version prefix on GitHub (#336)
This commit is contained in:
parent
00957a2317
commit
5f85d89974
|
@ -55,11 +55,19 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// fetch data
|
||||||
GitRelease release = await this.Client
|
GitRelease release = await this.Client
|
||||||
.GetAsync(string.Format(this.ReleaseUrlFormat, id))
|
.GetAsync(string.Format(this.ReleaseUrlFormat, id))
|
||||||
.As<GitRelease>();
|
.As<GitRelease>();
|
||||||
|
|
||||||
return new ModInfoModel(id, release.Tag, $"https://github.com/{id}/releases");
|
// extract fields
|
||||||
|
string name = id;
|
||||||
|
string version = release.Tag;
|
||||||
|
if (version.StartsWith("v")) // common format on GitHub
|
||||||
|
version = version.Substring(1);
|
||||||
|
string url = $"https://github.com/{id}/releases";
|
||||||
|
|
||||||
|
return new ModInfoModel(name, version, url);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue