diff --git a/osu.Game.Tests/Resources/Archives/skin-with-subfolder-zip-entries.osk b/osu.Game.Tests/Resources/Archives/skin-with-subfolder-zip-entries.osk new file mode 100644 index 0000000000..013bca3801 Binary files /dev/null and b/osu.Game.Tests/Resources/Archives/skin-with-subfolder-zip-entries.osk differ diff --git a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs index 606a5afac2..62e7a80435 100644 --- a/osu.Game.Tests/Skins/IO/ImportSkinTest.cs +++ b/osu.Game.Tests/Skins/IO/ImportSkinTest.cs @@ -173,6 +173,16 @@ namespace osu.Game.Tests.Skins.IO assertCorrectMetadata(import1, "name 1 [my custom skin 1]", "author 1", 1.0m, osu); }); + [Test] + public Task TestImportWithSubfolder() => runSkinTest(async osu => + { + const string filename = "Archives/skin-with-subfolder-zip-entries.osk"; + var import = await loadSkinIntoOsu(osu, new ImportTask(TestResources.OpenResource(filename), filename)); + + assertCorrectMetadata(import, $"Totally fully features skin [Real Skin with Real Features] [{filename[..^4]}]", "Unknown", 2.7m, osu); + Assert.That(import.PerformRead(r => r.Files.Count), Is.EqualTo(3)); + }); + #endregion #region Cases where imports should be uniquely imported diff --git a/osu.Game/IO/Archives/ZipArchiveReader.cs b/osu.Game/IO/Archives/ZipArchiveReader.cs index 7d7ce858dd..cc5c65d184 100644 --- a/osu.Game/IO/Archives/ZipArchiveReader.cs +++ b/osu.Game/IO/Archives/ZipArchiveReader.cs @@ -46,7 +46,7 @@ namespace osu.Game.IO.Archives archiveStream.Dispose(); } - public override IEnumerable Filenames => archive.Entries.Select(e => e.Key).ExcludeSystemFileNames(); + public override IEnumerable Filenames => archive.Entries.Where(e => !e.IsDirectory).Select(e => e.Key).ExcludeSystemFileNames(); private class MemoryOwnerMemoryStream : Stream {