Skip to content

Commit 38a7e0d

Browse files
committed
writeDiffRangeDataExtensionPack: escape special characters in filenames
1 parent e49d1a4 commit 38a7e0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/analyze.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,11 @@ extensions:
511511
let data = ranges
512512
.map(
513513
(range) =>
514-
` - ["${range.path}", ${range.startLine}, ${range.endLine}]\n`,
514+
// Using yaml.dump() with `forceQuotes: true` ensures that all special
515+
// characters are escaped, and that the path is always rendered as a
516+
// quoted string on a single line.
517+
` - [${yaml.dump(range.path, { forceQuotes: true }).trim()}, ` +
518+
`${range.startLine}, ${range.endLine}]\n`,
515519
)
516520
.join("");
517521
if (!data) {

0 commit comments

Comments
 (0)