News download: Fix a bug that could cause a crash when downloading an SVG image. Fixes #1669530 [Fetching News for "New York Times" produces error](https://bugs.launchpad.net/calibre/+bug/1669530)

See https://bugreports.qt.io/browse/QTBUG-59266
This commit is contained in:
Kovid Goyal 2017-03-03 00:55:06 +05:30
parent faf46f844f
commit 0041d18a2c

View File

@ -397,7 +397,7 @@ class RecursiveFetcher(object):
if isinstance(fname, unicode):
fname = fname.encode('ascii', 'replace')
itype = what(None, data)
if itype is None and b'<svg' in data[:1024]:
if itype == 'svg' or (itype is None and b'<svg' in data[:1024]):
# SVG image
imgpath = os.path.join(diskpath, fname+'.svg')
with self.imagemap_lock: