Skip to content

Commit

Permalink
Fix handling forward and backward slashed paths on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Cimbali committed Apr 4, 2021
1 parent 71d71d4 commit 1c7cf14
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pympress/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,12 @@ def path_to_uri(path):
pos = path.index(':') if ':' in path else -1
if path[pos:pos + 3] == '://' and pos > 1 and set(path[:pos]) <= set(scheme_chars):
return path
else:

try:
# A msys/mingw path on windows has unexpected forward-slashes
return urljoin('file:', pathname2url(path))
except OSError:
return 'file://' + path


@staticmethod
Expand Down

0 comments on commit 1c7cf14

Please sign in to comment.