Skip to content

Commit 0bca6f7

Browse files
committed
Add additional url parsing tool.
1 parent be01fdb commit 0bca6f7

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/py/kaleido/_page_generator.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from pathlib import Path
44
from urllib.parse import urlparse
5+
from urllib.request import url2pathname
56

67
import logistro
78

@@ -22,7 +23,13 @@ def _ensure_path(path: Path | str | tuple[str | Path, str]) -> None:
2223
_logger.debug(f"Ensuring path {path!s}")
2324
if urlparse(str(path)).scheme.startswith("http"): # is url
2425
return
25-
if not Path(urlparse(str(path)).path).exists():
26+
if not Path(
27+
url2pathname(
28+
urlparse(
29+
str(path),
30+
).path,
31+
),
32+
).exists():
2633
raise FileNotFoundError(f"{path!s} does not exist.")
2734

2835

0 commit comments

Comments
 (0)