Ticket #4478: pil_validator_fix.patch

File pil_validator_fix.patch, 837 bytes (added by SmileyChris, 8 years ago)
  • django/core/validators.py

     
    175175        raise ValidationError, gettext("No file was submitted. Check the encoding type on the form.")
    176176    try:
    177177        Image.open(StringIO(content))
    178     except IOError: # Python Imaging Library doesn't recognize it as an image
     178    except IOError, OverflowError: # Python Imaging Library doesn't recognize it as an image
     179        # OverflowError is due to a bug in PIL with Python 2.4+ which can cause
     180        # it to gag on OLE files.
    179181        raise ValidationError, gettext("Upload a valid image. The file you uploaded was either not an image or a corrupted image.")
    180182
    181183def isValidImageURL(field_data, all_data):
Back to Top