fix: Couldn't save documents
This commit is contained in:
parent
918f9fb294
commit
6af686f3bd
|
@ -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)
|
||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
Loading…
Reference in New Issue