mail: check files are PDF before importing them (#13509)

This commit is contained in:
Frédéric Péters 2016-11-13 21:27:30 +01:00
parent c67574d814
commit 2482143850
1 changed files with 2 additions and 0 deletions

View File

@ -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()