From 485c3e8e5385cd5004a2829cc1d45c25e4ea9d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 17 Apr 2025 10:10:07 +0200 Subject: [PATCH] Refuse to import scores specifying incompatible mods Supersedes https://github.com/ppy/osu/pull/32817. The messaging of the failure to the user is maybe not the cleanest, but I'm not sure it's worth putting time in to improve it? --- osu.Game/Scoring/ScoreImporter.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Scoring/ScoreImporter.cs b/osu.Game/Scoring/ScoreImporter.cs index 69c53af16f..4b3f4a5e63 100644 --- a/osu.Game/Scoring/ScoreImporter.cs +++ b/osu.Game/Scoring/ScoreImporter.cs @@ -17,6 +17,7 @@ using osu.Game.Scoring.Legacy; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; +using osu.Game.Utils; using Realms; namespace osu.Game.Scoring @@ -90,6 +91,9 @@ namespace osu.Game.Scoring ArgumentNullException.ThrowIfNull(model.BeatmapInfo); ArgumentNullException.ThrowIfNull(model.Ruleset); + if (!ModUtils.CheckCompatibleSet(model.Mods)) + throw new InvalidOperationException(@"The score specifies an incompatible set of mods!"); + if (string.IsNullOrEmpty(model.StatisticsJson)) model.StatisticsJson = JsonConvert.SerializeObject(model.Statistics);