SSH remoting: Don't panic when opening root, open ~ instead (#19322)
Release Notes: - Fixed a panic when doing `zed ssh://server/`
This commit is contained in:
parent
0c04fb9862
commit
c888101e4b
1 changed files with 6 additions and 6 deletions
|
@ -247,14 +247,9 @@ impl WorktreeStore {
|
||||||
if abs_path.starts_with("/~") {
|
if abs_path.starts_with("/~") {
|
||||||
abs_path = abs_path[1..].to_string();
|
abs_path = abs_path[1..].to_string();
|
||||||
}
|
}
|
||||||
if abs_path.is_empty() {
|
if abs_path.is_empty() || abs_path == "/" {
|
||||||
abs_path = "~/".to_string();
|
abs_path = "~/".to_string();
|
||||||
}
|
}
|
||||||
let root_name = PathBuf::from(abs_path.clone())
|
|
||||||
.file_name()
|
|
||||||
.unwrap()
|
|
||||||
.to_string_lossy()
|
|
||||||
.to_string();
|
|
||||||
cx.spawn(|this, mut cx| async move {
|
cx.spawn(|this, mut cx| async move {
|
||||||
let this = this.upgrade().context("Dropped worktree store")?;
|
let this = this.upgrade().context("Dropped worktree store")?;
|
||||||
|
|
||||||
|
@ -272,6 +267,11 @@ impl WorktreeStore {
|
||||||
return Ok(existing_worktree);
|
return Ok(existing_worktree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let root_name = PathBuf::from(&response.canonicalized_path)
|
||||||
|
.file_name()
|
||||||
|
.map(|n| n.to_string_lossy().to_string())
|
||||||
|
.unwrap_or(response.canonicalized_path.to_string());
|
||||||
|
|
||||||
let worktree = cx.update(|cx| {
|
let worktree = cx.update(|cx| {
|
||||||
Worktree::remote(
|
Worktree::remote(
|
||||||
SSH_PROJECT_ID,
|
SSH_PROJECT_ID,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue