mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 03:16:29 +03:00
legacy (.bak) import: If backup files can't be opened, just try one that couldn't be opened
fix https://github.com/deltachat/deltachat-android/issues/1768
This commit is contained in:
@@ -514,6 +514,7 @@ pub(crate) async fn get_next_backup_path(
|
|||||||
) -> Result<(PathBuf, PathBuf), Error> {
|
) -> Result<(PathBuf, PathBuf), Error> {
|
||||||
let folder = PathBuf::from(folder.as_ref());
|
let folder = PathBuf::from(folder.as_ref());
|
||||||
let stem = chrono::NaiveDateTime::from_timestamp(backup_time, 0)
|
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")
|
.format("delta-chat-backup-%Y-%m-%d")
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
|
|||||||
13
src/imex.rs
13
src/imex.rs
@@ -179,10 +179,15 @@ pub async fn has_backup_old(context: &Context, dir_name: impl AsRef<Path>) -> Re
|
|||||||
info!(context, "backup_time of {} is {}", name, curr_backup_time);
|
info!(context, "backup_time of {} is {}", name, curr_backup_time);
|
||||||
sql.close().await;
|
sql.close().await;
|
||||||
}
|
}
|
||||||
Err(e) => warn!(
|
Err(e) => {
|
||||||
context,
|
warn!(
|
||||||
"Found backup file {} which could not be opened: {}", name, e
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user