mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
CachedFileField: Do not store file that does not pass validation
This commit is contained in:
@@ -259,6 +259,12 @@ class CachedFileField(ExtFileField):
|
||||
if isinstance(data, File):
|
||||
if hasattr(data, '_uploaded_to'):
|
||||
return data._uploaded_to
|
||||
|
||||
try:
|
||||
self.clean(data)
|
||||
except ValidationError:
|
||||
return None
|
||||
|
||||
cf = CachedFile.objects.create(
|
||||
expires=now() + datetime.timedelta(days=1),
|
||||
date=now(),
|
||||
|
||||
Reference in New Issue
Block a user