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.
Files changed (17) hide show
  1. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/PKG-INFO +1 -1
  2. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/links.py +18 -3
  3. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/version.py +1 -1
  4. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/.gitignore +0 -0
  5. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/README.md +0 -0
  6. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/pyproject.toml +0 -0
  7. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/__init__.py +0 -0
  8. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/config.py +0 -0
  9. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/conformance.py +0 -0
  10. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/core.py +0 -0
  11. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/errors.py +0 -0
  12. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/extension.py +0 -0
  13. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/py.typed +0 -0
  14. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/requests.py +0 -0
  15. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/rfc3339.py +0 -0
  16. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/search.py +0 -0
  17. {stac_fastapi_types-6.3.1 → stac_fastapi_types-6.3.2}/stac_fastapi/types/stac.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stac-fastapi-types
3
- Version: 6.3.1
3
+ Version: 6.3.2
4
4
  Summary: Core API for stac-fastapi modules.
5
5
  Project-URL: Homepage, https://github.com/stac-utils/stac-fastapi
6
6
  Author-email: ArturoAI <engineering@arturo.ai>
@@ -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["href"].lstrip("/")
27
- link.update({"href": urljoin(base_url, f"{path}/{href}")})
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
 
@@ -1,3 +1,3 @@
1
1
  """Library version."""
2
2
 
3
- __version__ = "6.3.1"
3
+ __version__ = "6.3.2"