Recognize json as plain text (if no other handlers are present). (#261)

* Recognize json as plain text (if no other handlers are present).
This commit is contained in:
afourney
2025-01-03 16:40:43 -08:00
committed by GitHub
parent 436407288f
commit 05b78e7ce1
3 changed files with 23 additions and 1 deletions

View File

@@ -173,7 +173,10 @@ class PlainTextConverter(DocumentConverter):
# Only accept text files
if content_type is None:
return None
elif "text/" not in content_type.lower():
elif all(
not content_type.lower().startswith(type_prefix)
for type_prefix in ["text/", "application/json"]
):
return None
text_content = str(from_path(local_path).best())