Skip to content

Commit

Permalink
Fix relative paths on Windows
Browse files Browse the repository at this point in the history
Fix #236.
  • Loading branch information
liZe committed Apr 18, 2019
1 parent b2534b0 commit 90f1e94
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cairosvg/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ def normalize_url(url):
# Match input ``url`` like the following:
# - C:\\Directory\\zzz.svg
# - Blah.svg
if not url.startswith('file:'):
if not url.startswith('file:') and os.path.isabs(url):
url = os.path.abspath(url)
if '#' in url:
url, part = url.rsplit('#', 1)
else:
part = None
url = Path(url).resolve().as_uri()
if part is not None:
url = url + '#' + part

# Match input ``url`` like the following:
# - file://C:\\Directory\\zzz.svg
Expand Down

0 comments on commit 90f1e94

Please sign in to comment.