Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make asset HREFs relative or absolute based on CatalogType during save #251

Merged
merged 3 commits into from
Jan 14, 2021

Conversation

lossyrob
Copy link
Member

@lossyrob lossyrob commented Jan 14, 2021

Previously only link href types (absolute vs relative) were modified as part of the Catalog.save process based on the catalog types: for ABSOLUTE_PUBLISHED, all link hrefs were made absolute, etc. The asset HREFs were not modified, which was counter to the expected result outlined in stac-utils/stactools#31.

This change causes asset HREFs to also be changed to absolute or relative based on the catalog type. Note that if the asset HREF cannot be made relative, e.g. the asset HREF points to an HTTP location and the item is being stored locally, then the HREF is left unchanged.

Also upgrade yapf to 0.30.* and add a scripts/format script to run code formatting.

Previously only link href types (absolute vs relative) were modified
as part of the `Catalog.save` process based on the catalog types: for
ABSOLUTE_PUBLISHED, all link hrefs were made absolute, etc. The asset
HREFs were not modified, which was counter to the expected result
outlined in stac-utils/stactools#31.

This change causes asset HREFs to also be changed to absolute or
relative based on the catalog type. Note that if the asset HREF cannot
be made relative, e.g. the asset HREF points to an HTTP location and
the item is being stored locally, then the HREF is left unchanged.
@codecov-io
Copy link

codecov-io commented Jan 14, 2021

Codecov Report

Merging #251 (2944349) into develop (abfa723) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #251      +/-   ##
===========================================
+ Coverage    93.97%   94.00%   +0.02%     
===========================================
  Files           32       32              
  Lines         3967     3969       +2     
===========================================
+ Hits          3728     3731       +3     
+ Misses         239      238       -1     
Impacted Files Coverage Δ
pystac/catalog.py 95.63% <100.00%> (+0.02%) ⬆️
pystac/validation/stac_validator.py 92.30% <100.00%> (ø)
pystac/item.py 98.19% <0.00%> (+0.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update abfa723...2944349. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants