From 79f7f0ecad2f5721ee84470db9f415cdcb57f417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 2 Sep 2025 14:46:39 +0200 Subject: [PATCH] Ignore `.osu` files not placed at top level of beatmap archive on import Closes https://github.com/ppy/osu/issues/34677. --- osu.Game/Beatmaps/BeatmapImporter.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapImporter.cs b/osu.Game/Beatmaps/BeatmapImporter.cs index 28997509dc..f80c4de4ea 100644 --- a/osu.Game/Beatmaps/BeatmapImporter.cs +++ b/osu.Game/Beatmaps/BeatmapImporter.cs @@ -367,7 +367,11 @@ namespace osu.Game.Beatmaps { var beatmaps = new List(); - foreach (var file in beatmapSet.Files.Where(f => f.Filename.EndsWith(".osu", StringComparison.OrdinalIgnoreCase))) + // stable appears to ignore `.osu` files which are not placed at the top level of the beatmap archive. + // the logic that achieves this is very difficult to make sense of, but appears to be located somewhere around + // https://github.com/peppy/osu-stable-reference/blob/67795dba3c308e7d0493b296149dcb073ca47ecb/osu!/GameplayElements/Beatmaps/BeatmapManager.cs#L207-L208 + // only testing the `/` path separator character is sufficient as `RealmNamedFileUsage`s are normalised to use the front slash unix path separator convention + foreach (var file in beatmapSet.Files.Where(f => !f.Filename.Contains('/') && f.Filename.EndsWith(@".osu", StringComparison.OrdinalIgnoreCase))) { using (var memoryStream = new MemoryStream(Files.Store.Get(file.File.GetStoragePath()))) // we need a memory stream so we can seek {