diff --git a/apps/dc_tools/odc/apps/dc_tools/_stac.py b/apps/dc_tools/odc/apps/dc_tools/_stac.py index 6793c9544..8ed722dbd 100644 --- a/apps/dc_tools/odc/apps/dc_tools/_stac.py +++ b/apps/dc_tools/odc/apps/dc_tools/_stac.py @@ -183,8 +183,17 @@ def _get_relative_path(asset_href, self_link): if self_link is None: return asset_href - self_path = urlparse(self_link).path - href_path = urlparse(asset_href).path + self_parsed = urlparse(self_link) + href_parsed = urlparse(asset_href) + + # keep as an absolute link if scheme or netloc differ + if self_parsed.scheme != href_parsed.scheme: + return asset_href + if self_parsed.netloc != href_parsed.netloc: + return asset_href + + self_path = self_parsed.path + href_path = href_parsed.path try: return str(Path(href_path).relative_to(Path(self_path).parent))