]> Untitled Git - lemmy.git/commitdiff
Check that config is valid before saving (#2152)
authorNutomic <me@nutomic.com>
Thu, 24 Mar 2022 16:23:12 +0000 (16:23 +0000)
committerGitHub <noreply@github.com>
Thu, 24 Mar 2022 16:23:12 +0000 (16:23 +0000)
crates/utils/src/settings/mod.rs

index 92c9fb01f308573185e0a44b37e5f1e383f1054d..bf1a8984df2ab97111f244b4c81671ceab768838 100644 (file)
@@ -88,6 +88,9 @@ impl Settings {
   }
 
   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)?;
 
     // Reload the new settings