diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-11 01:03:27 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-11 01:03:27 -0400 |
commit | c41e1ed5c16d5402fa373267095e28121b4055f2 (patch) | |
tree | 6312d117ed2ae4a03957e6d29642d80ffff75fe3 | |
parent | 4b82b111e7392e695b0e021efac2385c1b9850af (diff) | |
download | SMAPI-c41e1ed5c16d5402fa373267095e28121b4055f2.tar.gz SMAPI-c41e1ed5c16d5402fa373267095e28121b4055f2.tar.bz2 SMAPI-c41e1ed5c16d5402fa373267095e28121b4055f2.zip |
fix new validation not allowing capitals in semver tags
-rw-r--r-- | src/SMAPI.Tests/Utilities/SemanticVersionTests.cs | 2 | ||||
-rw-r--r-- | src/StardewModdingAPI.Toolkit/SemanticVersion.cs | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs index 9091ef09..35d74b60 100644 --- a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs +++ b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs @@ -22,6 +22,7 @@ namespace StardewModdingAPI.Tests.Utilities [TestCase("3000.4000.5000", ExpectedResult = "3000.4000.5000")] [TestCase("1.2-some-tag.4", ExpectedResult = "1.2-some-tag.4")] [TestCase("1.2.3-some-tag.4", ExpectedResult = "1.2.3-some-tag.4")] + [TestCase("1.2.3-SoME-tAg.4", ExpectedResult = "1.2.3-SoME-tAg.4")] [TestCase("1.2.3-some-tag.4 ", ExpectedResult = "1.2.3-some-tag.4")] public string Constructor_FromString(string input) { @@ -35,6 +36,7 @@ namespace StardewModdingAPI.Tests.Utilities [TestCase(1, 2, 3, " ", ExpectedResult = "1.2.3")] [TestCase(1, 2, 3, "0", ExpectedResult = "1.2.3-0")] [TestCase(1, 2, 3, "some-tag.4", ExpectedResult = "1.2.3-some-tag.4")] + [TestCase(1, 2, 3, "sOMe-TaG.4", ExpectedResult = "1.2.3-sOMe-TaG.4")] [TestCase(1, 2, 3, "some-tag.4 ", ExpectedResult = "1.2.3-some-tag.4")] public string Constructor_FromParts(int major, int minor, int patch, string tag) { diff --git a/src/StardewModdingAPI.Toolkit/SemanticVersion.cs b/src/StardewModdingAPI.Toolkit/SemanticVersion.cs index 3008a4d6..de480416 100644 --- a/src/StardewModdingAPI.Toolkit/SemanticVersion.cs +++ b/src/StardewModdingAPI.Toolkit/SemanticVersion.cs @@ -256,7 +256,7 @@ namespace StardewModdingAPI.Toolkit { if (this.Tag.Trim() == "") throw new FormatException($"{this} isn't a valid semantic version. The tag cannot be a blank string (but may be omitted)."); - if (!Regex.IsMatch(this.Tag, $"^{SemanticVersion.TagPattern}$")) + if (!Regex.IsMatch(this.Tag, $"^{SemanticVersion.TagPattern}$", RegexOptions.IgnoreCase)) throw new FormatException($"{this} isn't a valid semantic version. The tag is invalid."); } } |