From 74d9e6efb02a406b0045fc1c3ab52c3d422b347d Mon Sep 17 00:00:00 2001 From: htmltiger <1429451+htmltiger@users.noreply.github.com> Date: Sat, 16 Apr 2022 23:46:51 +0100 Subject: [PATCH] keep old file permission workaround --- custom_components/config_editor/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/config_editor/__init__.py b/custom_components/config_editor/__init__.py index 24b2879..b7f61c2 100644 --- a/custom_components/config_editor/__init__.py +++ b/custom_components/config_editor/__init__.py @@ -90,11 +90,12 @@ def drec(r, s): except: mode = 0o666 with AtomicWriter(fullpath, overwrite=True).open() as fdesc: + fdesc.write(content) + with open(fullpath, 'a') as fdesc: try: os.fchmod(fdesc.fileno(), mode) except: pass - fdesc.write(content) except: res = "Saving Failed" _LOGGER.exception(res+": %s", fullpath)