From cc6995fe16b666d632b9d207f2d531b887fbf832 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 13 Sep 2023 20:51:48 -0700 Subject: [PATCH] Fix PR description HTML escaping, the surrounding `
` tag
 shouldn't be escaped

---
 llvm/utils/git/github-automation.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index 0517cac286a30..eac5816b5499f 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -132,14 +132,14 @@ def run(self) -> bool:
             patch = html.escape(requests.get(self.pr.diff_url).text)
         except:
             patch = ""
-        diff_stats += "\n
\n" + patch
+        diff_stats += "\n
\n" + html.escape(patch)
 
         # GitHub limits comments to 65,536 characters, let's limit the diff to 20kB.
         DIFF_LIMIT = 20 * 1024
         patch_link = f"Full diff: {self.pr.diff_url}\n"
         if len(patch) > DIFF_LIMIT:
             patch_link = f"\nPatch is {human_readable_size(len(patch))}, truncated to {human_readable_size(DIFF_LIMIT)} below, full version: {self.pr.diff_url}\n"
-            diff_stats = html.escape(diff_stats[0:DIFF_LIMIT]) + "...\n\n"
+            diff_stats = diff_stats[0:DIFF_LIMIT] + "...\n\n"
         diff_stats += "
" team_mention = "@llvm/{}".format(team.slug)