Don't allow dropping files on remote projects (#11218)
Release Notes: - Fixed a panic when a remote participant dropped a local file on your project
This commit is contained in:
parent
f11a7811f3
commit
cb7350174e
2 changed files with 25 additions and 5 deletions
|
@ -8525,11 +8525,13 @@ impl Project {
|
||||||
OpenBuffer::Weak(_) => {}
|
OpenBuffer::Weak(_) => {}
|
||||||
},
|
},
|
||||||
hash_map::Entry::Vacant(e) => {
|
hash_map::Entry::Vacant(e) => {
|
||||||
assert!(
|
if !is_remote {
|
||||||
is_remote,
|
debug_panic!(
|
||||||
"received buffer update from {:?}",
|
"received buffer update from {:?}",
|
||||||
envelope.original_sender_id
|
envelope.original_sender_id
|
||||||
);
|
);
|
||||||
|
return Err(anyhow!("received buffer update for non-remote project"));
|
||||||
|
}
|
||||||
e.insert(OpenBuffer::Operations(ops));
|
e.insert(OpenBuffer::Operations(ops));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1891,6 +1891,24 @@ impl Pane {
|
||||||
let mut to_pane = cx.view().clone();
|
let mut to_pane = cx.view().clone();
|
||||||
let mut split_direction = self.drag_split_direction;
|
let mut split_direction = self.drag_split_direction;
|
||||||
let paths = paths.paths().to_vec();
|
let paths = paths.paths().to_vec();
|
||||||
|
let is_remote = self
|
||||||
|
.workspace
|
||||||
|
.update(cx, |workspace, cx| {
|
||||||
|
if workspace.project().read(cx).is_remote() {
|
||||||
|
workspace.show_error(
|
||||||
|
&anyhow::anyhow!("Cannot drop files on a remote project"),
|
||||||
|
cx,
|
||||||
|
);
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.unwrap_or(true);
|
||||||
|
if is_remote {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self.workspace
|
self.workspace
|
||||||
.update(cx, |workspace, cx| {
|
.update(cx, |workspace, cx| {
|
||||||
let fs = Arc::clone(workspace.project().read(cx).fs());
|
let fs = Arc::clone(workspace.project().read(cx).fs());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue