4687: Thumbnails for SVG

Misery

What version of Djblets are you using?

1.0.5

Which module(s) have the problem?

djblets/util/templatetags/djblets_images

What steps will reproduce the problem?

  1. Upload a SVG as an attachment
  2. Show the review request
  3. Looks into the log file

What is the expected output? What do you see instead?

No stacktrace in error log

If SVG is not supported by PIL it should not try to thumbnail it.

https://github.com/python-pillow/Pillow/issues/1146

What version of Python and Django?

1.6.11.7 and 2.7.14

Please provide any additional information below.

2018-04-09 08:05:50,885 - ERROR - - djblets.util.templatetags.djblets_images - Error thumbnailing image file uploaded/files/2018/03/29/5e8a3e07-9663-4c4c-97ec-f0d16dfa46bb__trash_icon.svg and saving as uploaded/files/2018/03/29/5e8a3e07
-9663-4c4c-97ec-f0d16dfa46bb__trash_icon_600.svg: cannot identify image file <cStringIO.StringI object at 0x7ffa605dee00>
Traceback (most recent call last):
File "/opt/reviewboard/dist/lib/python2.7/site-packages/djblets/util/templatetags/djblets_images.py", line 126, in thumbnail
image = Image.open(data)
File "/opt/reviewboard/dist/lib/python2.7/site-packages/PIL/Image.py", line 2585, in open
% (filename if filename else fp))
IOError: cannot identify image file <cStringIO.StringI object at 0x7ffa605dee00>