Skip to content

Fix PR description HTML escaping, the surrounding <pre> tag shouldn't be escaped #66322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/utils/git/github-automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ def run(self) -> bool:
patch = html.escape(requests.get(self.pr.diff_url).text)
except:
patch = ""
diff_stats += "\n<pre>\n" + patch
diff_stats += "\n<pre>\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<truncated>\n"
diff_stats = diff_stats[0:DIFF_LIMIT] + "...\n<truncated>\n"
diff_stats += "</pre>"
team_mention = "@llvm/{}".format(team.slug)

Expand Down