mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 21:36:29 +03:00
Save modified .toml if absolute paths were replaced with relative
Previously this required adding or removing an account.
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- fix: only send contact changed event for recently seen if it is relevant (not too old to matter) #3938
|
- fix: only send contact changed event for recently seen if it is relevant (not too old to matter) #3938
|
||||||
|
- Immediately save `accounts.toml` if it was modified by a migration from absolute paths to relative paths #3943
|
||||||
|
|
||||||
## 1.105.0
|
## 1.105.0
|
||||||
|
|
||||||
|
|||||||
@@ -367,13 +367,20 @@ impl Config {
|
|||||||
|
|
||||||
// Previous versions of the core stored absolute paths in account config.
|
// Previous versions of the core stored absolute paths in account config.
|
||||||
// Convert them to relative paths.
|
// Convert them to relative paths.
|
||||||
|
let mut modified = false;
|
||||||
for account in &mut inner.accounts {
|
for account in &mut inner.accounts {
|
||||||
if let Ok(new_dir) = account.dir.strip_prefix(dir) {
|
if let Ok(new_dir) = account.dir.strip_prefix(dir) {
|
||||||
account.dir = new_dir.to_path_buf();
|
account.dir = new_dir.to_path_buf();
|
||||||
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Config { file, inner })
|
let config = Self { file, inner };
|
||||||
|
if modified {
|
||||||
|
config.sync().await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads all accounts defined in the configuration file.
|
/// Loads all accounts defined in the configuration file.
|
||||||
|
|||||||
Reference in New Issue
Block a user