mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-17 20:13:46 +00:00
Fixed a bug with reading md files
This commit is contained in:
1 parent
2404899e28
commit
897b4ef2cd
1 file changed
+6
-2
@@ -119,8 +119,12 @@ class MarkdownParser(BaseParser):
|
|||||||
self, filepath: Path, errors: str = "ignore"
|
self, filepath: Path, errors: str = "ignore"
|
||||||
) -> List[Tuple[Optional[str], str]]:
|
) -> List[Tuple[Optional[str], str]]:
|
||||||
"""Parse file into tuples."""
|
"""Parse file into tuples."""
|
||||||
with open(filepath, "r") as f:
|
with open(filepath, "r", encoding='utf8') as f:
|
||||||
content = f.read()
|
try:
|
||||||
|
content = f.read()
|
||||||
|
except (Exception,) as e:
|
||||||
|
print(f'Error a file: "{filepath}"')
|
||||||
|
raise e
|
||||||
if self._remove_hyperlinks:
|
if self._remove_hyperlinks:
|
||||||
content = self.remove_hyperlinks(content)
|
content = self.remove_hyperlinks(content)
|
||||||
if self._remove_images:
|
if self._remove_images:
|
||||||
|
|||||||
Reference in new issue
Block a user