diff --git a/dotdrop/config.py b/dotdrop/config.py index d3a8ae5..2b7e351 100644 --- a/dotdrop/config.py +++ b/dotdrop/config.py @@ -569,8 +569,9 @@ class Cfg: """writes the config to file""" ret = False with open(path, 'w') as f: - ret = yaml.dump(content, f, - default_flow_style=False, indent=2) + ret = yaml.safe_dump(content, f, + default_flow_style=False, + indent=2) return ret def _norm_key_elem(self, elem): @@ -827,7 +828,9 @@ class Cfg: self.lnk_settings[self.key_dotpath] = self.curdotpath self.lnk_settings[self.key_workdir] = self.curworkdir # dump - ret = yaml.dump(self.content, default_flow_style=False, indent=2) + ret = yaml.safe_dump(self.content, + default_flow_style=False, + indent=2) ret = ret.replace('{}', '') # restore paths self.lnk_settings[self.key_dotpath] = dotpath diff --git a/tests/test_config.py b/tests/test_config.py index 460d6c7..a3112f3 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -79,7 +79,8 @@ class TestConfig(unittest.TestCase): # save the new config with open(confpath, 'w') as f: - yaml.dump(content, f, default_flow_style=False, indent=2) + yaml.safe_dump(content, f, default_flow_style=False, + indent=2) # do the tests conf = Cfg(confpath) @@ -109,7 +110,8 @@ class TestConfig(unittest.TestCase): # save the new config with open(confpath, 'w') as f: - yaml.dump(content, f, default_flow_style=False, indent=2) + yaml.safe_dump(content, f, default_flow_style=False, + indent=2) # do the tests conf = Cfg(confpath)