keep old file permission workaround

This commit is contained in:
htmltiger 2022-04-16 23:46:51 +01:00 committed by GitHub
parent 5616917064
commit 74d9e6efb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,11 +90,12 @@ async def websocket_create(hass, connection, msg):
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)