Skip to content

Commit e545d30

Browse files
committed
writeDiffRangeDataExtensionPack: escape special characters in filenames
1 parent 986ebaf commit e545d30

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
@@ -507,7 +507,11 @@ extensions:
507507
let data = ranges
508508
.map(
509509
(range) =>
510-
` - ["${range.path}", ${range.startLine}, ${range.endLine}]\n`,
510+
// Using yaml.dump() with `forceQuotes: true` ensures that all special
511+
// characters are escaped, and that the path is always rendered as a
512+
// quoted string on a single line.
513+
` - [${yaml.dump(range.path, { forceQuotes: true }).trim()}, ` +
514+
`${range.startLine}, ${range.endLine}]\n`,
511515
)
512516
.join("");
513517
if (!data) {

0 commit comments

Comments
 (0)