Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
fs: Avoid resolving symlinks when trashing (#58339)
Dino381f2f4977b2
diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rsindex 7809e65eeb3..ce1798a73cc 100644--- a/crates/fs/src/fs.rs+++ b/crates/fs/src/fs.rs@@ -802,10 +802,10 @@ impl Fs for RealFs {// We must make the path absolute or trash will make a weird abomination// of the zed working directory (not usually the worktree) and whatever// the path variable holds.- let path = self- .canonicalize(path)- .await- .context("Could not canonicalize the path of the file")?;+ // We deliberately use `std::path::absolute` instead of `canonicalize`+ // to avoid resolving symlinks. Otherwise trashing a symlink would trash+ // its target and leave the link behind.+ let path = std::path::absolute(path).context("Could not make the path absolute")?;let (tx, rx) = futures::channel::oneshot::channel();std::thread::Builder::new()