Check that config is valid before saving (#2152)

lower_reqwest_timeout
Nutomic 2022-03-24 16:23:12 +00:00 committed by GitHub
parent b406342a14
commit 83e996111e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -88,6 +88,9 @@ impl Settings {
} }
pub fn save_config_file(data: &str) -> Result<String, LemmyError> { pub fn save_config_file(data: &str) -> Result<String, LemmyError> {
// check that the config is valid
from_str::<Settings>(data)?;
fs::write(Settings::get_config_location(), data)?; fs::write(Settings::get_config_location(), data)?;
// Reload the new settings // Reload the new settings