Browse Source

fix task_service.py (#8687)

Fix the case where pages variable might be None

### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.20.0
Fee He 3 months ago
parent
commit
ae3683c346
No account linked to committer's email address
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      api/db/services/task_service.py

+ 2
- 0
api/db/services/task_service.py View File

file_bin = STORAGE_IMPL.get(bucket, name) file_bin = STORAGE_IMPL.get(bucket, name)
do_layout = doc["parser_config"].get("layout_recognize", "DeepDOC") do_layout = doc["parser_config"].get("layout_recognize", "DeepDOC")
pages = PdfParser.total_page_number(doc["name"], file_bin) pages = PdfParser.total_page_number(doc["name"], file_bin)
if pages is None:
pages = 0
page_size = doc["parser_config"].get("task_page_size") or 12 page_size = doc["parser_config"].get("task_page_size") or 12
if doc["parser_id"] == "paper": if doc["parser_id"] == "paper":
page_size = doc["parser_config"].get("task_page_size") or 22 page_size = doc["parser_config"].get("task_page_size") or 22

Loading…
Cancel
Save