Skip to content

Commit

Permalink
update stac_io from owner root (#762)
Browse files Browse the repository at this point in the history
* update stac_io from owner root

* updating CHANGELOG

* Update pystac/link.py

Adding @lossyrob suggestion to avoid root link from resolving when it is the root.

Co-authored-by: Rob Emanuele <rdemanuele@gmail.com>

Co-authored-by: Rob Emanuele <rdemanuele@gmail.com>
Co-authored-by: Jon Duckworth <duckontheweb@gmail.com>
  • Loading branch information
3 people authored Mar 17, 2022
1 parent 15a31fa commit bcdf2e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

- Enum MediaType entry for PDF documents ([#758](https://github.com/stac-utils/pystac/pull/758))
- Updated Link to obtain stac_io from owner root ([#762](https://github.com/stac-utils/pystac/pull/762))

### Removed

Expand Down
4 changes: 4 additions & 0 deletions pystac/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ def resolve_stac_object(self, root: Optional["Catalog_Type"] = None) -> "Link":
if self.owner is not None:
if isinstance(self.owner, pystac.Catalog):
stac_io = self.owner._stac_io
elif self.rel != pystac.RelType.ROOT:
owner_root = self.owner.get_root()
if owner_root is not None:
stac_io = owner_root._stac_io
if stac_io is None:
stac_io = pystac.StacIO.default()

Expand Down

0 comments on commit bcdf2e7

Please sign in to comment.