fix: Couldn't save documents

This commit is contained in:
Dendy 2024-02-24 12:37:31 +01:00
parent 918f9fb294
commit 6af686f3bd
1 changed files with 2 additions and 2 deletions

View File

@ -81,7 +81,7 @@ class DocumentTree():
def document_read(self, path: str) -> str | None: def document_read(self, path: str) -> str | None:
internal_path = os.path.join(self.base, *path.split('/')) + '.md' internal_path = os.path.join(self.base, *path.split('/')) + '.md'
if os.path.exists(internal_path): if os.path.exists(internal_path):
return open(internal_path).read() return open(internal_path, 'r').read()
# File doesn't exist # File doesn't exist
return None return None
@ -90,7 +90,7 @@ class DocumentTree():
internal_path = os.path.join(self.base, *path.split('/')) + '.md' internal_path = os.path.join(self.base, *path.split('/')) + '.md'
# TODO: Check if the directory exists before writing # TODO: Check if the directory exists before writing
with open(internal_path) as file: with open(internal_path, 'w') as file:
file.write(text) file.write(text)
# ------------------------------- # -------------------------------