From fe257effcee8c70ee5ad4d3a80defbdedef23e76 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Mon, 29 Nov 2021 14:05:48 +0100 Subject: [PATCH] properly open encrypted state db --- crates/matrix-sdk-base/src/store/indexeddb_store/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/matrix-sdk-base/src/store/indexeddb_store/mod.rs b/crates/matrix-sdk-base/src/store/indexeddb_store/mod.rs index 49a5514ea..f36fab9fa 100644 --- a/crates/matrix-sdk-base/src/store/indexeddb_store/mod.rs +++ b/crates/matrix-sdk-base/src/store/indexeddb_store/mod.rs @@ -176,9 +176,9 @@ impl IndexeddbStore { } pub async fn open_with_passphrase(name: String, passphrase: &str) -> Result { - let path = format!("{:0}::matrix-sdk-state", name); + let name = format!("{:0}::matrix-sdk-state", name); - let mut db_req: OpenDbRequest = IdbDatabase::open_u32(&path, 1)?; + let mut db_req: OpenDbRequest = IdbDatabase::open_u32(&name, 1)?; db_req.set_on_upgrade_needed(Some(|evt: &IdbVersionChangeEvent| -> Result<(), JsValue> { if evt.old_version() < 1.0 { // migrating to version 1 @@ -192,7 +192,7 @@ impl IndexeddbStore { let db: IdbDatabase = db_req.into_future().await?; let tx: IdbTransaction = - db.transaction_on_one_with_mode(&path, IdbTransactionMode::Readwrite)?; + db.transaction_on_one_with_mode("matrix-sdk-state", IdbTransactionMode::Readwrite)?; let ob = tx.object_store("matrix-sdk-state")?; let store_key: Option = ob