mirror of https://github.com/django/django.git
Fixed #7673: make sure to rewind uploaded image data when validating ImageFields. Thanks, Mike Axiak.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7907 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5f73e2c4fa
commit
e63f8bf655
|
@ -507,6 +507,8 @@ class ImageField(FileField):
|
||||||
trial_image.verify()
|
trial_image.verify()
|
||||||
except Exception: # Python Imaging Library doesn't recognize it as an image
|
except Exception: # Python Imaging Library doesn't recognize it as an image
|
||||||
raise ValidationError(self.error_messages['invalid_image'])
|
raise ValidationError(self.error_messages['invalid_image'])
|
||||||
|
if hasattr(f, 'seek') and callable(f.seek):
|
||||||
|
f.seek(0)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
url_re = re.compile(
|
url_re = re.compile(
|
||||||
|
|
Loading…
Reference in New Issue