stac-fastapi.types 6.3.1__tar.gz → 6.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/PKG-INFO +1 -1
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/links.py +18 -3
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/version.py +1 -1
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/.gitignore +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/README.md +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/pyproject.toml +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/__init__.py +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/config.py +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/conformance.py +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/core.py +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/errors.py +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/extension.py +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/py.typed +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/requests.py +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/rfc3339.py +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/search.py +0 -0
- {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/stac.py +0 -0
|
@@ -19,12 +19,27 @@ def filter_links(links: list[dict]) -> list[dict]:
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def resolve_links(links: list, base_url: str) -> list[dict]:
|
|
22
|
-
"""Convert relative links to absolute links.
|
|
22
|
+
"""Convert relative links to absolute links while preserving existing absolute URLs.
|
|
23
|
+
|
|
24
|
+
This function processes links and applies the base_url and proxy path to relative URLs
|
|
25
|
+
However, it explicitly preserves absolute URLs (starting with http:// or https://) to
|
|
26
|
+
prevent mangling of external links stored in STAC items (e.g., license URLs, external
|
|
27
|
+
documentation links).
|
|
28
|
+
"""
|
|
23
29
|
filtered_links = filter_links(links)
|
|
24
30
|
path = urlsplit(base_url).path.rstrip("/")
|
|
25
31
|
for link in filtered_links:
|
|
26
|
-
href = link
|
|
27
|
-
|
|
32
|
+
href = str(link.get("href", ""))
|
|
33
|
+
|
|
34
|
+
# Do not mangle URLs that are already absolute
|
|
35
|
+
if href.startswith(("http://", "https://")):
|
|
36
|
+
continue
|
|
37
|
+
|
|
38
|
+
# Remove leading slash to prevent urljoin from replacing the entire path
|
|
39
|
+
href = href.lstrip("/")
|
|
40
|
+
# Construct the full path with proxy path preserved
|
|
41
|
+
full_path = f"{path}/{href}" if path else href
|
|
42
|
+
link.update({"href": urljoin(base_url, full_path)})
|
|
28
43
|
return filtered_links
|
|
29
44
|
|
|
30
45
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|