Skip to content

Commit 4da5eb6

Browse files
Potential fix for code scanning alert no. 2: Incomplete string escaping or encoding
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent cb65cb6 commit 4da5eb6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/autoFix.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ export function autoFixReadme(raw: string, options?: { multiLineStyle?: 'indente
7474
} else if (block.length === 1) {
7575
// single line -> inline code
7676
const content = block[0].trim();
77-
const inline = '`' + content.replace(/`/g, '\\`') + '`';
77+
// Escape backslashes, then backticks
78+
const escapedContent = content.replace(/\\/g, '\\\\').replace(/`/g, '\\`');
79+
const inline = '`' + escapedContent + '`';
7880
output.push(inline);
7981
changes.push(`Converted single-line fenced block at line ${startIndex + 1} to inline code`);
8082
} else {

0 commit comments

Comments
 (0)