1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 06:33:20 +08:00

Merge pull request #12173 from frenzibyte/osk-ignore-case

This commit is contained in:
Dean Herbert 2021-03-25 14:58:09 +09:00 committed by GitHub
commit e0b12abcc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 3 deletions

View File

@ -113,6 +113,31 @@ namespace osu.Game.Tests.Skins.IO
}
}
[Test]
public async Task TestImportUpperCasedOskArchive()
{
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(ImportSkinTest)))
{
try
{
var osu = LoadOsuIntoHost(host);
var imported = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOsk("name 1", "author 1"), "skin1.OsK"));
Assert.That(imported.Name, Is.EqualTo("name 1"));
Assert.That(imported.Creator, Is.EqualTo("author 1"));
var imported2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOsk("name 1", "author 1"), "skin1.oSK"));
Assert.That(imported2.Hash, Is.EqualTo(imported.Hash));
}
finally
{
host.Exit();
}
}
}
private MemoryStream createOsk(string name, string author)
{
var zipStream = new MemoryStream();

View File

@ -104,7 +104,7 @@ namespace osu.Game.Skinning
protected override string ComputeHash(SkinInfo item, ArchiveReader reader = null)
{
// we need to populate early to create a hash based off skin.ini contents
if (item.Name?.Contains(".osk") == true)
if (item.Name?.Contains(".osk", StringComparison.OrdinalIgnoreCase) == true)
populateMetadata(item);
if (item.Creator != null && item.Creator != unknown_creator_string)
@ -122,7 +122,7 @@ namespace osu.Game.Skinning
{
await base.Populate(model, archive, cancellationToken).ConfigureAwait(false);
if (model.Name?.Contains(".osk") == true)
if (model.Name?.Contains(".osk", StringComparison.OrdinalIgnoreCase) == true)
populateMetadata(model);
}
@ -137,7 +137,7 @@ namespace osu.Game.Skinning
}
else
{
item.Name = item.Name.Replace(".osk", "");
item.Name = item.Name.Replace(".osk", "", StringComparison.OrdinalIgnoreCase);
item.Creator ??= unknown_creator_string;
}
}