unstructured/example-docs/fake-text-all-whitespace.txt
Tomasz Cąkała 75c4998bc7
Fix: partition on empty or whitespace-only text files (#3675)
This is a fix for this
[bug](https://github.com/Unstructured-IO/unstructured/issues/3674), auto partition fails on text files which are empty or contain only whitespaces

Inference of .txt file type fails if the file has only whitespaces.

To Reproduce:

```
from tempfile import NamedTemporaryFile

from unstructured.partition.auto import partition

with NamedTemporaryFile(mode="w", suffix=".txt") as f:
    f.write("   \n")
    f.seek(0)
    elements = partition(filename=f.name)
```
2024-09-28 21:16:33 -07:00

4 lines
3 B
Plaintext