Skip to content

Commit 61de93b

Browse files
committed
Fix file path detection to ignore matches within markdown headings
1 parent 0e49189 commit 61de93b

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎apps/editor/src/commands/apply-chat-response-command/utils/clipboard-parser/parsers/multiple-files-parser/multiple-files-parser.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,10 @@ export const parse_multiple_files = (params: {
332332
const after = line.substring(match.index! + match[0].length)
333333

334334
// Avoid matching file paths that are part of a sentence.
335-
if (!(/[a-zA-Z]/.test(before) && /[a-zA-Z]/.test(after))) {
335+
if (
336+
is_header_line ||
337+
!(/[a-zA-Z]/.test(before) && /[a-zA-Z]/.test(after))
338+
) {
336339
const trimmed_line = line.trim()
337340
const is_comment_or_header =
338341
trimmed_line.startsWith('#') ||

‎apps/editor/src/commands/apply-chat-response-command/utils/clipboard-parser/test-cases/standard/multiple-markdowns-with-headings/multiple-markdowns-with-headings.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### New file: `src/hello.md`
1+
### New file: `src/hello.md` (lorem ipsum)
22

33
```markdown
44
## hello

0 commit comments

Comments
 (0)