Page MenuHomePhabricator

Thumbor failing on some SVGs with "ValueError: invalid literal for int() with base 10"
Closed, ResolvedPublic

Description

Exception thrown by

self.internal_size = map(int, self.exif['ImageSize'].split('x')) in imagemagick.py

Example affected file: https://commons.wikimedia.org/wiki/File:Tree_edges.svg

Revisions and Commits

Event Timeline

Turns out that this file starts with some invisible characters before the <?xml, which makes it fall back to the default attempt of rendering through the imagemagick engine - not knowing what kind of file we're dealing with - and that in turns fails in this particular way (but would fail later by being unable to convert the image anyway).

The invisible characters are simply UTF-8 encoded BOM. Which means that this might be a valid file still and that's the issue to solve. It's probably a good idea to skip the BOM in general, for all file types.

Change 409314 had a related patch set uploaded (by Gilles; owner: Gilles):
[operations/debs/python-thumbor-wikimedia@master] Upgrade to 1.12

https://gerrit.wikimedia.org/r/409314

Change 409314 merged by Filippo Giunchedi:
[operations/debs/python-thumbor-wikimedia@master] Upgrade to 1.12

https://gerrit.wikimedia.org/r/409314