Harden PRD live-site smoke

This commit is contained in:
2026-05-08 20:37:42 -04:00
parent 8e450496e0
commit 3df998876b
6 changed files with 67 additions and 11 deletions
+3
View File
@@ -39,6 +39,9 @@ pub enum CoreError {
#[error("private profile keeps sync paused: {id}")]
PrivateProfileSyncLocked { id: ProfileId },
#[error("private profile cannot be a space default profile: {id}")]
PrivateProfileDefaultLocked { id: ProfileId },
#[error("download not found: {id}")]
DownloadNotFound { id: DownloadId },
+7 -2
View File
@@ -289,8 +289,13 @@ impl BrowserCore {
space_id: &SpaceId,
profile_id: &ProfileId,
) -> Result<(), CoreError> {
if !self.profiles.iter().any(|profile| profile.id() == profile_id) {
return Err(CoreError::ProfileNotFound { id: profile_id.clone() });
let profile = self
.profiles
.iter()
.find(|profile| profile.id() == profile_id)
.ok_or_else(|| CoreError::ProfileNotFound { id: profile_id.clone() })?;
if profile.kind() == &ProfileKind::Private {
return Err(CoreError::PrivateProfileDefaultLocked { id: profile_id.clone() });
}
let space = self