summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-09-24 02:15:28 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-09-24 02:15:28 -0400
commit5f85d89974c3f1974f8e3d372f12b1cac743cd3a (patch)
tree6635f09aa5d5848bd00876f4a165ee6843054ccf /src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs
parent00957a23177f792d4e4962854697779831d51ca1 (diff)
downloadSMAPI-5f85d89974c3f1974f8e3d372f12b1cac743cd3a.tar.gz
SMAPI-5f85d89974c3f1974f8e3d372f12b1cac743cd3a.tar.bz2
SMAPI-5f85d89974c3f1974f8e3d372f12b1cac743cd3a.zip
handle common 'v' version prefix on GitHub (#336)
Diffstat (limited to 'src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs')
-rw-r--r--src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs b/src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs
index b08e8b4d..f794c605 100644
--- a/src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs
+++ b/src/StardewModdingAPI.Web/Framework/ModRepositories/GitHubRepository.cs
@@ -55,11 +55,19 @@ namespace StardewModdingAPI.Web.Framework.ModRepositories
{
try
{
+ // fetch data
GitRelease release = await this.Client
.GetAsync(string.Format(this.ReleaseUrlFormat, id))
.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)
{