Skip to content

Commit

Permalink
Fix collections and native app issue (#4685)
Browse files Browse the repository at this point in the history
Collections were not visible in the organization view.
This was because the `flexibleCollections` was set to `true`

Found an issue with loading some old created Secure Notes which had `{}` or `{"type":null}` as there `data` value.
This isn't allowed. When detected, replace it with `{"type":0}`

Fixes #4682
Fixes #4590
  • Loading branch information
BlackDex authored Jul 3, 2024
1 parent a4c7fad commit d42b264
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/db/models/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ impl Cipher {
}
}

// Fix secure note issues when data is `{}`
// This breaks at least the native mobile clients
if self.atype == 2 && (self.data.eq("{}") || self.data.to_ascii_lowercase().eq("{\"type\":null}")) {
type_data_json = json!({"type": 0});
}

// Clone the type_data and add some default value.
let mut data_json = type_data_json.clone();

Expand Down
2 changes: 1 addition & 1 deletion src/db/models/organization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ impl UserOrganization {
"accessSecretsManager": false,
"limitCollectionCreationDeletion": true,
"allowAdminAccessToAllCollectionItems": true,
"flexibleCollections": true,
"flexibleCollections": false,

"permissions": permissions,

Expand Down

0 comments on commit d42b264

Please sign in to comment.