From cea66c3cf4446a66b84985f83cc71a9ed51ac88d Mon Sep 17 00:00:00 2001 From: Gordon Lin <75815453+gordlin@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:22:26 -0500 Subject: [PATCH] Slackbot: Escape special characters --- .github/slack-bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/slack-bot.py b/.github/slack-bot.py index aa45abf2..291bacb0 100644 --- a/.github/slack-bot.py +++ b/.github/slack-bot.py @@ -9,7 +9,8 @@ # Summarization (example model, could be adjusted) summarizer = pipeline('summarization', model='tuner007/pegasus_summarizer') -neutral_summary = summarizer(pr_body, max_length=200, min_length=25, do_sample=False)[0]['summary_text'] +# Escape double quotes and literal backslashes +neutral_summary = summarizer(pr_body, max_length=200, min_length=25, do_sample=False)[0]['summary_text'].replace('"', '\\"') # PR label types with associated metadata pr_label_types = {