1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 11:42:54 +08:00

Refuse to apply online metadata in the most dodgy scenarios

This commit is contained in:
Bartłomiej Dach 2024-02-12 11:12:01 +01:00
parent 834db989f7
commit 4f0ae4197a
No known key found for this signature in database

View File

@ -43,7 +43,7 @@ namespace osu.Game.Beatmaps
if (!tryLookup(beatmapInfo, preferOnlineFetch, out var res))
continue;
if (res == null)
if (res == null || shouldDiscardLookupResult(res, beatmapInfo))
{
beatmapInfo.ResetOnlineInfo();
continue;
@ -72,6 +72,17 @@ namespace osu.Game.Beatmaps
}
}
private bool shouldDiscardLookupResult(OnlineBeatmapMetadata result, BeatmapInfo beatmapInfo)
{
if (beatmapInfo.OnlineID > 0 && result.BeatmapID != beatmapInfo.OnlineID)
return true;
if (beatmapInfo.OnlineID == -1 && result.MD5Hash != beatmapInfo.MD5Hash)
return true;
return false;
}
/// <summary>
/// Attempts to retrieve the <see cref="OnlineBeatmapMetadata"/> for the given <paramref name="beatmapInfo"/>.
/// </summary>