-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Reported by .Krona through Discord.
UploadContract:
http://localhost:40147/hm5/UploadContract?checkpointIndex=20&competitionAllowInvites=true&competitionDuration=0&competitionParticipants=%27%27&description=%27A%20Contract%20has%20been%20issued%20on%20Mark%20%27River%27%20Shuford.<BR><BR>Perform%20the%20operation%20as%20quickly%20and%20effectively%20as%20possible%2C%20paying%20attention%20to%20the%20special%20Conditions%20stipulated%20by%20the%20client.<BR><BR>Good%20hunting%2C%2047.'&difficulty=1&exitId=2&levelIndex=3&metacategoriesJson='%5B0%2C1%5D'&restrictionsJson='%5B1%5D'&score=100785&startingoutfittoken=-947477428&startingweapontoken=1575676105&targetsJson='%5B{"AmmoType"%3A0%2C"Name"%3A"Mark%20%27River%27%20Shuford"%2C"OutfitToken"%3A-947477428%2C"SpecialSituation"%3A0%2C"WeaponToken"%3A1575676105}%5D'&title='Contract'&userId='76561198106622591'
SearchForContracts2:
http://localhost:40147/hm5/SearchForContracts2?categoryid=0&checkpointid=-1&contractid=%27%27&contractname=%27%27&difficulty=-1&levelindex=-1&range=10&sort=0&startindex=0&userid=%2776561197989140534%27&view=60
The contract contains: Mark \\u0027River\\u0027 Shuford\ instead of Mark 'River' Shuford.
Analysis:
- The game properly escapes the single quote characters in the Targets JSON:
Mark%20%27River%27%20Shuford - When responding back to the game, the Targets JSON contains:
Mark \\u0027River\\u0027 Shuford\ - The game cannot handle escaped unicode characters and crashes during load. This will most likely be the case for anything that responds as "JSON in a string".
The offending line is in AnyToJsonStringConverter:
| writer.WriteStringValue(JsonSerializer.Serialize(value)); |
At the time, I chose not to forward the JsonSerializerOptions, but doing so now seems to fix this particular issue. I however do not know what the effect of this is in the bigger scheme of things. This will have to be tested. Included is a new version of the original server emulator (pre-Cobra). If tests succeed, I will include this fix in the next version properly.
[Removed]
The JsonEntryResponse_ProducesCorrectResult unit test now fails because it will convert a number to a string, but this may not actually be a problem...
EDIT: As expected, this broke more than it fixed. So I made a new version that retains the default JSON serialization, while not escaping unicode characters.
