mail: check files are PDF before importing them (#13509)
This commit is contained in:
parent
c67574d814
commit
2482143850
|
@ -36,6 +36,8 @@ class Command(BaseCommand):
|
|||
for filepath in args:
|
||||
if not os.path.exists(filepath):
|
||||
continue
|
||||
if not open(filepath).read(5) == '%PDF-':
|
||||
continue
|
||||
mail = Mail(content=File(open(filepath)))
|
||||
mail.scanner_category = kwargs.get('category')
|
||||
mail.save()
|
||||
|
|
Loading…
Reference in New Issue