diff --git a/src/dc_tools.rs b/src/dc_tools.rs index d1fb38670..7b7ac7207 100644 --- a/src/dc_tools.rs +++ b/src/dc_tools.rs @@ -514,6 +514,7 @@ pub(crate) async fn get_next_backup_path( ) -> Result<(PathBuf, PathBuf), Error> { let folder = PathBuf::from(folder.as_ref()); let stem = chrono::NaiveDateTime::from_timestamp(backup_time, 0) + // Don't change this file name format, in has_backup() we use string comparison to determine which backup is newer: .format("delta-chat-backup-%Y-%m-%d") .to_string(); diff --git a/src/imex.rs b/src/imex.rs index 863c83345..ce80e78a9 100644 --- a/src/imex.rs +++ b/src/imex.rs @@ -179,10 +179,15 @@ pub async fn has_backup_old(context: &Context, dir_name: impl AsRef) -> Re info!(context, "backup_time of {} is {}", name, curr_backup_time); sql.close().await; } - Err(e) => warn!( - context, - "Found backup file {} which could not be opened: {}", name, e - ), + Err(e) => { + warn!( + context, + "Found backup file {} which could not be opened: {}", name, e + ); + if newest_backup_path.is_none() { + newest_backup_path = Some(path); // If there is no other backup file, just try this one + } + } } } }