-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix failed to load beatmap detail host by deleted user #34169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Can you link a relevant beatmap? And also add a test case for this in |
https://osu.ppy.sh/beatmapsets/25
I didn't find any other test cases for deserialising raw JSON that I could refer to. It's a pretty complex json and I'm not sure if I should be doing this. Maybe we should have a deserialization test? Because this time the issue is in from Deserializer. The original response: |
|
The part I was interested in a test for was for how it actually displays with a user-id of 1. I was thinking you could do something like this: [Test]
public void TestDeletedUser()
{
AddStep("show map with deleted user", () =>
{
JObject jsonBlob = JObject.FromObject(getBeatmapSet(), new JsonSerializer
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
});
jsonBlob["user"] = JToken.Parse(
"""
{
"id": null,
"username": "[deleted user]"
}
""");
overlay.ShowBeatmapSet(JsonConvert.DeserializeObject<APIBeatmapSet>(JsonConvert.SerializeObject(jsonBlob)));
});
}Though you'll have to set a few more properties - perhaps |


I found that the current version cannot open the beatmap detail created by a deleted account.
This bug is introduced by #33783 .
The reason is that
user.idin the JSON returned by osu-web is null, which causes theAPIUserfail to deserialize.Because the
IdofAPIUserisint, it cannot be null.I don't want to change Id to
int?, so in this PR i addedNullValueHandling.Ignoreto it. This way, null values will be ignored during deserialize, andIdwill still retain its default value (i.e.1)