Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix shared collection deserialization

Manav Rathiac68b99ecff1
diff --git a/rust/CLAUDE.md b/rust/CLAUDE.md
index ef3d6db9ec..aa2b32dcbf 100644
--- a/rust/CLAUDE.md
+++ b/rust/CLAUDE.md
@@ -98,7 +98,7 @@ The project has completed foundational components (crypto, storage, models) and
## Commit Guidelines
-### Pre-commit Checklist
+### Pre-commit Checklist (RUN BEFORE EVERY COMMIT!)
**CRITICAL: CI will fail if ANY of these checks fail. Run ALL commands and ensure they ALL pass.**
diff --git a/rust/src/api/models.rs b/rust/src/api/models.rs
index 2985269923..3f96debc0d 100644
--- a/rust/src/api/models.rs
+++ b/rust/src/api/models.rs
@@ -170,7 +170,7 @@ pub struct Collection {
pub id: i64,
pub owner: CollectionUser,
pub encrypted_key: String,
- pub key_decryption_nonce: String,
+ pub key_decryption_nonce: Option<String>,
pub name: Option<String>,
pub encrypted_name: Option<String>,
pub name_decryption_nonce: Option<String>,
diff --git a/rust/src/commands/export.rs b/rust/src/commands/export.rs
index 2d12d70c2a..4493a2d90e 100644
--- a/rust/src/commands/export.rs
+++ b/rust/src/commands/export.rs
@@ -181,9 +181,18 @@ async fn export_account(storage: &Storage, account: &Account, filter: &ExportFil
);
// Decrypt collection key
+ // Shared collections don't have key_decryption_nonce - they use a different mechanism
+ let Some(ref key_nonce) = collection.key_decryption_nonce else {
+ log::warn!(
+ "Collection {} appears to be shared (no key_decryption_nonce), skipping for now",
+ collection.id
+ );
+ continue;
+ };
+
let collection_key = match decrypt_collection_key(
&collection.encrypted_key,
- &collection.key_decryption_nonce,
+ key_nonce,
master_key,
secret_key,
) {