Check that config is valid before saving

This commit is contained in:
Felix Ableitner 2022-03-24 13:21:31 +01:00 committed by Dessalines
parent b406342a14
commit a46722b5f9

View 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