0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Merge branch 'kaedroho-issue-729'

This commit is contained in:
Matt Westcott 2014-10-29 16:48:29 +00:00
commit fe728f9c88

View File

@ -85,15 +85,19 @@ class WagtailImageField(ImageField):
# Couldn't get the PIL image, skip checking the internal file format
return
image_format = extension
if extension == 'jpg':
image_format = 'jpeg'
image_format = extension.upper()
if image_format == 'JPG':
image_format = 'JPEG'
internal_image_format = image.format.upper()
if internal_image_format == 'MPO':
internal_image_format = 'JPEG'
# Check that the internal format matches the extension
# It is possible to upload PSD files if their extension is set to jpg, png or gif. This should catch them out
if image.format.upper() != image_format.upper():
if internal_image_format != image_format:
raise ValidationError(self.error_messages['invalid_image_known_format'] % (
image_format.upper()
image_format,
), code='invalid_image_known_format')
def check_image_file_size(self, f):