Use computed plaintext_content to set file content rather than calling f.read again

This commit is contained in:
Saba
2023-10-14 13:28:34 -07:00
parent 09bb3686cc
commit ff2dbadc9d

View File

@@ -74,7 +74,7 @@ def get_plaintext_files(config: TextContentConfig) -> dict[str, str]:
plaintext_content = f.read()
if file.endswith(("html", "htm", "xml")):
plaintext_content = extract_html_content(plaintext_content)
filename_to_content_map[file] = f.read()
filename_to_content_map[file] = plaintext_content
except Exception as e:
logger.warning(f"Unable to read file: {file} as plaintext. Skipping file.")
logger.warning(e, exc_info=True)