Skip to content

Commit 4610465

Browse files
Made empty filename edge case more robust
1 parent 6ddac3e commit 4610465

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/unstructured_client/_hooks/custom/split_pdf_hook.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,13 @@ def _parse_form_data(self, decoded_data: MultipartDecoder) -> FormData:
299299
continue
300300

301301
if name == PARTITION_FORM_FILES_KEY:
302-
full_filename = part_params.get("filename") or SUBSTITUTE_FILENAME
302+
full_filename = part_params.get("filename")
303+
304+
if full_filename is None:
305+
full_filename = SUBSTITUTE_FILENAME
306+
else:
307+
full_filename = full_filename.strip()
308+
303309
splitted_filename = full_filename.split("/")
304310

305311
if len(splitted_filename) < 1:

0 commit comments

Comments
 (0)