Skip to content

Commit b280310

Browse files
fix: incomplete string escaping
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 6089e5d commit b280310

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/copy-discussions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ function formatPollData(poll) {
124124
options.forEach(option => {
125125
const votes = option.totalVoteCount || 0;
126126
if (votes > 0) {
127-
// Escape quotes in option text for Mermaid
128-
const escapedOption = option.option.replace(/"/g, '\\"');
127+
// Escape backslashes and quotes in option text for Mermaid
128+
const escapedOption = option.option.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
129129
pollMarkdown += ` "${escapedOption}" : ${votes}\n`;
130130
}
131131
});

0 commit comments

Comments
 (0)