1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:07:24 +08:00

Fix skin parser not stripping whitespace before parsing

This commit is contained in:
Dean Herbert 2021-03-18 15:36:07 +09:00
parent 822d469b2c
commit bb3c3f302a
3 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,2 @@
[General]
Version: 2

View File

@ -91,6 +91,15 @@ namespace osu.Game.Tests.Skins
Assert.AreEqual(2.0m, decoder.Decode(stream).LegacyVersion);
}
[Test]
public void TestStripWhitespace()
{
var decoder = new LegacySkinDecoder();
using (var resStream = TestResources.OpenResource("skin-with-space.ini"))
using (var stream = new LineBufferedReader(resStream))
Assert.AreEqual(2.0m, decoder.Decode(stream).LegacyVersion);
}
[Test]
public void TestDecodeLatestVersion()
{

View File

@ -36,6 +36,8 @@ namespace osu.Game.Beatmaps.Formats
if (ShouldSkipLine(line))
continue;
line = line.Trim();
if (line.StartsWith('[') && line.EndsWith(']'))
{
if (!Enum.TryParse(line[1..^1], out section))