Skip to content

Commit

Permalink
Merge pull request #534 from martijnthe/fix-529-svg-embedded-data-uri…
Browse files Browse the repository at this point in the history
…-image

Bugfix: handle SVGs containing images embedded as data URIs
  • Loading branch information
liZe committed Nov 16, 2017
2 parents 13012d1 + 38ac25b commit bd5e58f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion weasyprint/images.py
Expand Up @@ -121,7 +121,9 @@ def __init__(self, svg_data, base_url, url_fetcher):

def _cairosvg_url_fetcher(self, src, mimetype):
data = self._url_fetcher(src)
return data.get('string', data['file_obj'].read())
if 'string' in data:
return data['string']
return data['file_obj'].read()

def get_intrinsic_size(self, _image_resolution, font_size):
# Vector images may be affected by the font size.
Expand Down

0 comments on commit bd5e58f

Please sign in to comment.