Skip to content

Commit fb14c80

Browse files
committed
Extract and normalize file paths from diff lines when parsing clipboard content
1 parent 06c5607 commit fb14c80

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • apps/editor/src/commands/apply-chat-response-command/utils/clipboard-parser/parsers/diff-parser

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ const convert_code_block_to_new_file_diff = (params: {
182182
line.startsWith('+++ ') ||
183183
line.startsWith('diff --git ')
184184
) {
185+
const { from_path, to_path } = extract_paths_from_lines([line])
186+
const potential_path = to_path || from_path
187+
if (potential_path && potential_path != '/dev/null') {
188+
file_path = normalize_path(potential_path)
189+
break
190+
}
185191
continue
186192
}
187193

0 commit comments

Comments
 (0)