Merge branch 'kaedroho-issue-729'

pull/767/head
Matt Westcott 2014-10-29 16:48:29 +00:00
commit fe728f9c88
1 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

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