@@ -5,7 +5,7 @@ use std::{
55 sync:: { Arc , atomic:: AtomicUsize } ,
66} ;
77
8- use anyhow:: { Context as _, Result , anyhow} ;
8+ use anyhow:: { Context as _, Result , anyhow, bail } ;
99use collections:: { HashMap , HashSet } ;
1010use fs:: { Fs , copy_recursive} ;
1111use futures:: {
@@ -1203,6 +1203,16 @@ impl WorktreeStore {
12031203 RelPath :: from_proto ( & envelope. payload . new_path ) ?,
12041204 ) ;
12051205 let ( scan_id, entry) = this. update ( & mut cx, |this, cx| {
1206+ let Some ( ( _, project_id) ) = this. downstream_client else {
1207+ bail ! ( "no downstream client" )
1208+ } ;
1209+ let Some ( entry) = this. entry_for_id ( entry_id, cx) else {
1210+ bail ! ( "no such entry" ) ;
1211+ } ;
1212+ if entry. is_private && project_id != REMOTE_SERVER_PROJECT_ID {
1213+ bail ! ( "entry is private" )
1214+ }
1215+
12061216 let new_worktree = this
12071217 . worktree_for_id ( new_worktree_id, cx)
12081218 . context ( "no such worktree" ) ?;
@@ -1226,6 +1236,15 @@ impl WorktreeStore {
12261236 ) -> Result < proto:: ProjectEntryResponse > {
12271237 let entry_id = ProjectEntryId :: from_proto ( envelope. payload . entry_id ) ;
12281238 let worktree = this. update ( & mut cx, |this, cx| {
1239+ let Some ( ( _, project_id) ) = this. downstream_client else {
1240+ bail ! ( "no downstream client" )
1241+ } ;
1242+ let Some ( entry) = this. entry_for_id ( entry_id, cx) else {
1243+ bail ! ( "no entry" )
1244+ } ;
1245+ if entry. is_private && project_id != REMOTE_SERVER_PROJECT_ID {
1246+ bail ! ( "entry is private" )
1247+ }
12291248 this. worktree_for_entry ( entry_id, cx)
12301249 . context ( "worktree not found" )
12311250 } ) ??;
@@ -1246,6 +1265,18 @@ impl WorktreeStore {
12461265 let worktree = this
12471266 . worktree_for_entry ( entry_id, cx)
12481267 . context ( "no such worktree" ) ?;
1268+
1269+ let Some ( ( _, project_id) ) = this. downstream_client else {
1270+ bail ! ( "no downstream client" )
1271+ } ;
1272+ let entry = worktree
1273+ . read ( cx)
1274+ . entry_for_id ( entry_id)
1275+ . ok_or_else ( || anyhow ! ( "missing entry" ) ) ?;
1276+ if entry. is_private && project_id != REMOTE_SERVER_PROJECT_ID {
1277+ bail ! ( "entry is private" )
1278+ }
1279+
12491280 let scan_id = worktree. read ( cx) . scan_id ( ) ;
12501281 anyhow:: Ok ( (
12511282 scan_id,
0 commit comments