From: Nutomic Date: Thu, 24 Mar 2022 16:23:12 +0000 (+0000) Subject: Check that config is valid before saving (#2152) X-Git-Url: http://these/git/%24%7Bsubmission.url%7D?a=commitdiff_plain;h=83e996111e51aee4d65707605433378c19061ca0;p=lemmy.git Check that config is valid before saving (#2152) --- diff --git a/crates/utils/src/settings/mod.rs b/crates/utils/src/settings/mod.rs index 92c9fb01..bf1a8984 100644 --- a/crates/utils/src/settings/mod.rs +++ b/crates/utils/src/settings/mod.rs @@ -88,6 +88,9 @@ impl Settings { } pub fn save_config_file(data: &str) -> Result { + // check that the config is valid + from_str::(data)?; + fs::write(Settings::get_config_location(), data)?; // Reload the new settings