fix: migrate transports configured on 2.56 to also have a oauth:false flag

also fix test setup to include the oauth:false flag
This commit is contained in:
holger krekel
2026-07-25 14:56:24 +02:00
parent 98a902b2de
commit cd4850668f
2 changed files with 15 additions and 1 deletions

View File

@@ -2506,6 +2506,20 @@ UPDATE msgs SET state=24 WHERE state=18; -- Change OutPreparing to OutFailed.
.await?;
}
inc_and_check(&mut migration_version, 159)?;
if dbversion < migration_version {
// Core 2.56.0 stored login parameters without the `oauth2` field,
// but older cores require it when deserializing.
// Set it to false as OAuth2 is not supported anymore.
sql.execute_migration(
"UPDATE transports
SET entered_param=json_set(entered_param, '$.oauth2', json('false')),
configured_param=json_set(configured_param, '$.oauth2', json('false'))",
migration_version,
)
.await?;
}
let new_version = sql
.get_raw_config_int(VERSION_CFG)
.await?

View File

@@ -686,7 +686,7 @@ pub(crate) async fn add_pseudo_transport(context: &Context, addr: &str) -> Resul
(
addr,
serde_json::to_string(&EnteredLoginParam{addr: addr.to_string(), ..Default::default()})?,
format!(r#"{{"addr":"{addr}","imap":[],"imap_user":"","imap_password":"","smtp":[],"smtp_user":"","smtp_password":"","certificate_checks":"Automatic"}}"#)
format!(r#"{{"addr":"{addr}","imap":[],"imap_user":"","imap_password":"","smtp":[],"smtp_user":"","smtp_password":"","certificate_checks":"Automatic","oauth2":false}}"#)
),
)
.await?;