d6a270fd by 周伟奇

fix bug

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