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

Event Timeline

Gilles created this task.Feb 5 2018, 10:36 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 5 2018, 10:36 AM
Gilles added a comment.Feb 5 2018, 1:14 PM

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.

Gilles triaged this task as Low priority.Feb 5 2018, 1:37 PM
Gilles moved this task from Inbox to Doing on the Performance-Team board.Feb 5 2018, 9:08 PM

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

Mentioned in SAL (#wikimedia-operations) [2018-02-12T15:00:58Z] <godog> roll-upgrade thumbor to 1.12 - T186500 T186594 T186492

Gilles closed this task as Resolved.Feb 12 2018, 3:32 PM