Merge pull request #8 from htmltiger/htmltiger-patch-1

keep old file permission workaround
This commit is contained in:
htmltiger 2022-04-16 23:49:46 +01:00 committed by GitHub
commit 1bdf9684f3
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)