diff --git a/Lombiq.Tests.UI/Extensions/HtmlValidationResultExtensions.cs b/Lombiq.Tests.UI/Extensions/HtmlValidationResultExtensions.cs
index 99008752d..489d32f0c 100644
--- a/Lombiq.Tests.UI/Extensions/HtmlValidationResultExtensions.cs
+++ b/Lombiq.Tests.UI/Extensions/HtmlValidationResultExtensions.cs
@@ -46,9 +46,11 @@ private static IEnumerable ParseOutput(string output)
{
// In some cases the output is too large and is not a valid JSON anymore. In this case we need to fix it.
// tracking issue: https://github.com/atata-framework/atata-htmlvalidation/issues/9
- if (output.Trim().StartsWith('[') && !output.Trim().EndsWith(']'))
+ int index = output.IndexOf(",\"source\":", StringComparison.Ordinal);
+ if (index != -1)
{
- output += "\"}]";
+ output = output[..index];
+ output += "}]";
}
var document = JsonDocument.Parse(output);