Skip to content

Commit

Permalink
Fix collections and native app issue (dani-garcia#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 dani-garcia#4682
Fixes dani-garcia#4590
  • Loading branch information
BlackDex authored and ZhReimu committed Jul 9, 2024
1 parent 482bb16 commit eb9e3b9
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 eb9e3b9

Please sign in to comment.