Harden PRD live-site smoke
This commit is contained in:
@@ -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 },
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user