fix(notes): preserve file encoding when writing to filesystem (#59)

This commit is contained in:
Nathaniel Landau
2023-09-02 17:03:06 -04:00
committed by GitHub
parent 22e9719402
commit 10449b3e6a
7 changed files with 143 additions and 117 deletions

View File

@@ -448,7 +448,8 @@ class Note:
try:
log.trace(f"Writing note {p} to disk")
p.write_text(self.file_content)
content_bytes = bytes(self.file_content, self.encoding)
p.write_bytes(content_bytes)
except FileNotFoundError as e:
alerts.error(f"Note {p} not found. Exiting")
raise typer.Exit(code=1) from e