Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cairosvg/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,15 @@ def use(surface, node):
del node['viewBox']
if 'mask' in node:
del node['mask']
href = parse_url(node.get('{http://www.w3.org/1999/xlink}href')).geturl()

# the href attr should be in the xlink namespace,
# but some libs do not respect this
href = node.get('{http://www.w3.org/1999/xlink}href') or node.get('href')
href = parse_url(href).geturl()

if not href:
raise ValueError('Invalid <use> tag: {!r}'.format(node))

tree = Tree(
url=href, url_fetcher=node.url_fetcher, parent=node,
tree_cache=surface.tree_cache, unsafe=node.unsafe)
Expand Down