Page MenuHomePhabricator

'NoneType' object has no attribute 'lstrip'
Closed, ResolvedPublic

Description

Sep 13 11:11:05 thumbor1002 thumbor@8821[52527]: self.context.request.engine.load(fetch_result.buffer, extension)
Sep 13 11:11:05 thumbor1002 thumbor@8821[52527]: File "/usr/lib/python2.7/dist-packages/wikimedia_thumbor/engine/proxy/proxy.py", line 106, in load
Sep 13 11:11:05 thumbor1002 thumbor@8821[52527]: enginename = self.select_engine()
Sep 13 11:11:05 thumbor1002 thumbor@8821[52527]: File "/usr/lib/python2.7/dist-packages/wikimedia_thumbor/engine/proxy/proxy.py", line 54, in select_engine
Sep 13 11:11:05 thumbor1002 thumbor@8821[52527]: ext = self.lcl['extension'].lstrip('.')
Sep 13 11:11:05 thumbor1002 thumbor@8821[52527]: AttributeError: 'NoneType' object has no attribute 'lstrip'
Sep 13 11:11:05 thumbor1002 thumbor@8821[52527]: thumbor:ERROR [BaseHandler] get_image failed for url `http%3A//ms-fe.svc.eqiad.wmnet/v1/AUTH_mw/wikipedia-en-local-public.45/4/45/Denver_Broncos_alternate_logo.svg`. error: `'NoneType' object has no attribute 'lstrip'`
Sep 13 11:11:05 thumbor1002 thumbor@8821[52527]: tornado.access:ERROR 500 GET /wikipedia/en/thumb/4/45/Denver_Broncos_alternate_logo.svg/731px-Denver_Broncos_alternate_logo.svg.p (127.0.0.1) 342.52ms

Event Timeline

Another example:

Sep 13 11:18:32 thumbor1001 thumbor@8828[71306]: thumbor:ERROR [BaseHandler] get_image failed for url `http%3A//ms-fe.svc.eqiad.wmnet/v1/AUTH_mw/wikipedia-pt-local-public/6/68/Flamengo_escudo.svg`. error: `'NoneType' object has no attribute 'lstrip'`
Sep 13 11:18:32 thumbor1001 thumbor@8828[71306]: tornado.access:ERROR 500 GET /wikipedia/pt/thumb/6/68/Flamengo_escudo.svg/720px-Flamengo_escudo.svg (127.0.0.1) 190.19ms

I'm not sure why those fail in production, when I download those files and try them locally, they're correctly detected as SVG.

Found the answer: firefox was modifying the svg contents when opening the original. This should have been fixed by my tweaking of the SVG detection code.