##// END OF EJS Templates
Raise an error whena decompression bomb is launched to the thumbs generator
neko259 -
r1819:1bcad2dd default
parent child Browse files
Show More
@@ -25,6 +25,8 b' def generate_thumb(img, thumb_size, form'
25 (this format will be used for the generated thumbnail, too)
25 (this format will be used for the generated thumbnail, too)
26 """
26 """
27
27
28 Image.warnings.simplefilter('error', Image.DecompressionBombWarning)
29
28 img.seek(0) # see http://code.djangoproject.com/ticket/8222 for details
30 img.seek(0) # see http://code.djangoproject.com/ticket/8222 for details
29 image = Image.open(img)
31 image = Image.open(img)
30
32
@@ -212,4 +214,4 b' class ImageWithThumbsField(ImageField):'
212 thumb_height_ratio = int(original_height * scale_ratio)
214 thumb_height_ratio = int(original_height * scale_ratio)
213
215
214 setattr(instance, thumb_width_field, thumb_width_ratio)
216 setattr(instance, thumb_width_field, thumb_width_ratio)
215 setattr(instance, thumb_height_field, thumb_height_ratio) No newline at end of file
217 setattr(instance, thumb_height_field, thumb_height_ratio)
General Comments 0
You need to be logged in to leave comments. Login now