Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
writeDiffRangeDataExtensionPack: escape special characters in filenames
  • Loading branch information
cklin committed Jan 13, 2025
commit 3548ff54b5e54db237049bac959e13f48db15a76
6 changes: 5 additions & 1 deletion src/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,11 @@ extensions:
let data = ranges
.map(
(range) =>
` - ["${range.path}", ${range.startLine}, ${range.endLine}]\n`,
// Using yaml.dump() with `forceQuotes: true` ensures that all special
// characters are escaped, and that the path is always rendered as a
// quoted string on a single line.
` - [${yaml.dump(range.path, { forceQuotes: true }).trim()}, ` +
`${range.startLine}, ${range.endLine}]\n`,
)
.join("");
if (!data) {
Expand Down