Skip to content

Commit 4d4bc3f

Browse files
authored
SPMI: HTML escape lines inside diffs (#87861)
The summarize script will convert markdown diff code blocks into manually colored HTML tags because AzDO does not support proper highlighting in its preview. However, when we do this we should also take care to escape the contents as otherwise it can start being interpreted as HTML tags. For example, in a recent case a field named `<Option>k__BackingField` caused the preview to be truncated because `<option>` was interpreted as a HTML tag.
1 parent 1600677 commit 4d4bc3f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/coreclr/scripts/superpmi_diffs_summarize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
################################################################################
1515

1616
import argparse
17+
import html
1718
import os
1819
import re
1920
from coreclr_arguments import *
@@ -213,7 +214,7 @@ def main(main_args):
213214
inside_diff = False
214215
new_lines.append(html_color_diff(cur_diff_lines))
215216
elif inside_diff:
216-
cur_diff_lines.append(line)
217+
cur_diff_lines.append(html.escape(line, False))
217218
else:
218219
new_lines.append(line)
219220

0 commit comments

Comments
 (0)