Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix edge case with absolute file paths
Mikayla Makicd670e340fa4
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rsindex 57a45ddb169..fe8c6494202 100644--- a/crates/project_panel/src/project_panel.rs+++ b/crates/project_panel/src/project_panel.rs@@ -547,7 +547,7 @@ impl ProjectPanel {worktree_id,entry_id: NEW_ENTRY_ID,});- let new_path = entry.path.join(&filename);+ let new_path = entry.path.join(&filename.trim_start_matches("/"));if path_already_exists(new_path.as_path()) {return None;}@@ -2111,7 +2111,7 @@ mod tests {let confirm = panel.update(cx, |panel, cx| {panel.filename_editor.update(cx, |editor, cx| {- editor.set_text("bdir1/dir2/the-new-filename", cx)+ editor.set_text("/bdir1/dir2/the-new-filename", cx)});panel.confirm(&Confirm, cx).unwrap()});@@ -2124,7 +2124,7 @@ mod tests {" > a"," > b"," > C",- " [PROCESSING: 'bdir1/dir2/the-new-filename'] <== selected",+ " [PROCESSING: '/bdir1/dir2/the-new-filename'] <== selected"," .dockerignore","v root2"," > d",