Fix error after notetype merge + downgrade

This commit is contained in:
Damien Elmes 2024-01-12 15:16:27 +10:00
parent 4ccb814fb3
commit f21b5aec12
2 changed files with 3 additions and 2 deletions

View file

@ -186,6 +186,7 @@ static RESERVED_NOTETYPE_KEYS: Set<&'static str> = phf_set! {
"flds", "flds",
"css", "css",
"originalStockKind", "originalStockKind",
"originalId",
"id", "id",
"usn", "usn",
"mod", "mod",

View file

@ -345,7 +345,7 @@ impl SqliteStorage {
let nts = self let nts = self
.get_schema11_notetypes() .get_schema11_notetypes()
.map_err(|e| AnkiError::JsonError { .map_err(|e| AnkiError::JsonError {
info: format!("decoding models: {}", e), info: format!("decoding models: {:?}", e),
})?; })?;
let mut names = HashSet::new(); let mut names = HashSet::new();
for (mut ntid, nt) in nts { for (mut ntid, nt) in nts {
@ -383,7 +383,7 @@ impl SqliteStorage {
let notetypes = stmt let notetypes = stmt
.query_and_then([], |row| -> Result<HashMap<NotetypeId, NotetypeSchema11>> { .query_and_then([], |row| -> Result<HashMap<NotetypeId, NotetypeSchema11>> {
let v: HashMap<NotetypeId, NotetypeSchema11> = let v: HashMap<NotetypeId, NotetypeSchema11> =
serde_json::from_str(row.get_ref_unwrap(0).as_str()?)?; serde_json::from_value(serde_json::from_str(row.get_ref_unwrap(0).as_str()?)?)?;
Ok(v) Ok(v)
})? })?
.next() .next()