d6a270fd by 周伟奇

fix bug

1 parent 4c2b01b1
......@@ -282,11 +282,14 @@ class DocView(GenericView, DocHandler):
pdf_file = args.get('pdf_file')
file_write(pdf_file, tmp_save_path)
# if not fitz.open("pdf", pdf_file).isPDF:
file = fitz.Document(tmp_save_path)
if not file.isPDF:
file.close()
try:
file = fitz.Document(tmp_save_path)
except Exception as e:
raise self.invalid_params(msg='invalid params: not a PDF file')
else:
if not file.isPDF:
file.close()
raise self.invalid_params(msg='invalid params: not a PDF file')
file.close()
# 1. 上传信息记录
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!