From 2903848c62192dae26c3991949a8e67a3332cfa6 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 2 Jun 2021 17:12:59 +1000 Subject: [PATCH] handle duplicate ids in values when upgrading deck config Multiple configs with the same inner id would lead to errors like the following when trying to open the collection: DeckConfigInner.interval_multiplier: invalid wire type: StartGroup (expected ThirtyTwoBit) --- rslib/src/storage/deckconfig/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rslib/src/storage/deckconfig/mod.rs b/rslib/src/storage/deckconfig/mod.rs index ba7d12776..3d1895982 100644 --- a/rslib/src/storage/deckconfig/mod.rs +++ b/rslib/src/storage/deckconfig/mod.rs @@ -162,7 +162,9 @@ impl SqliteStorage { }) .map_err(Into::into) })?; - for (_, mut conf) in conf.into_iter() { + for (id, mut conf) in conf.into_iter() { + // buggy clients may have failed to set inner id to match hash key + conf.id = id; self.add_deck_conf_schema14(&mut conf)?; } self.db.execute_batch("update col set dconf=''")?;