cartads cs: catch ValueError that pdfrw missed (#44394)
This commit is contained in:
parent
8bfc2dfe2d
commit
46e7fb62d5
|
@ -646,7 +646,7 @@ class AbstractCartaDSCS(BaseResource):
|
|||
pdf = pdfrw.PdfReader(request.FILES['files[]'])
|
||||
if not any(pdfrw.findobjs.find_objects(pdf, valid_subtypes=(pdfrw.PdfName.Form,))):
|
||||
return [{'error': force_text(_('The CERFA should not be a scanned document.'))}]
|
||||
except pdfrw.PdfParseError:
|
||||
except (pdfrw.PdfParseError, ValueError):
|
||||
return [{'error': force_text(_('The CERFA should be a PDF file.'))}]
|
||||
else:
|
||||
if request.FILES['files[]'].content_type not in ('application/pdf', 'image/jpeg'):
|
||||
|
|
Loading…
Reference in New Issue