Skip to content

Commit 64dce3a

Browse files
committed
Only for windows
1 parent 334e314 commit 64dce3a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pystac/link.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def get_href(self, transform_href: bool = True) -> str | None:
191191
owner_href = self.owner.get_self_href()
192192
if owner_href is not None:
193193
href = make_relative_href(href, owner_href)
194+
194195
return href
195196

196197
@property

pystac/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,13 @@ def safe_urlparse(href: str) -> URLParseResult:
7171
query=parsed.query,
7272
fragment=parsed.fragment,
7373
)
74-
if parsed.scheme == "file":
75-
# Windows drives sometimes get parsed as the netloc and sometimes
76-
# as part of the parsed.path.
74+
75+
# Windows drives sometimes get parsed as the netloc and sometimes
76+
# as part of the parsed.path.
77+
if parsed.scheme == "file" and os.name == "nt":
7778
if parsed.netloc:
7879
path = f"{parsed.netloc}{parsed.path}"
79-
elif parsed.path.startswith("/") and os.name == "nt":
80+
elif parsed.path.startswith("/"):
8081
path = parsed.path[1:]
8182

8283
return URLParseResult(

0 commit comments

Comments
 (0)