Skip to content

Commit 3548ff5

Browse files
committed
writeDiffRangeDataExtensionPack: escape special characters in filenames
1 parent 52315a9 commit 3548ff5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/analyze.ts

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

0 commit comments

Comments
 (0)