浏览代码

fix(tools): handle empty language string in common.py

- Check if language string is empty and set it to None
- This prevents potential errors when an empty language string is passed
myhloli 1 年之前
父节点
当前提交
20ed0cd5fb
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      magic_pdf/tools/common.py

+ 3 - 0
magic_pdf/tools/common.py

@@ -94,6 +94,9 @@ def do_parse(
         f_draw_model_bbox = True
         f_draw_line_sort_bbox = True
 
+    if lang == "":
+        lang = None
+
     pdf_bytes = convert_pdf_bytes_to_bytes_by_pymupdf(pdf_bytes, start_page_id, end_page_id)
 
     orig_model_list = copy.deepcopy(model_list)