Skip to content

Commit 04f52e5

Browse files
authored
Sanitize only non-empty string value in the recorded json files (#22929)
1 parent fcb12d6 commit 04f52e5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/TestFx/Recorder/RecorderUtilities.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ public static string TryFormatJson(string content)
205205
{
206206
foreach (JToken token in parsedJson.SelectTokens(jsonPath))
207207
{
208-
token.Replace(SanitizeValue);
208+
if (token.Type == JTokenType.String && token.Value<string>() != string.Empty)
209+
{
210+
token.Replace(SanitizeValue);
211+
}
209212
}
210213
}
211214
return JsonConvert.SerializeObject(parsedJson, Formatting.Indented);

0 commit comments

Comments
 (0)