fix(results): derive each S3 link from its own HTTPS link#1373
Open
arpitjain099 wants to merge 3 commits into
Open
fix(results): derive each S3 link from its own HTTPS link#1373arpitjain099 wants to merge 3 commits into
arpitjain099 wants to merge 3 commits into
Conversation
_derive_s3_link iterated over the HTTPS links but built every derived S3 URL from links[0] rather than the current loop variable. For in-region cloud granules that only expose HTTPS GET DATA links, that returned the first file repeated for every link and dropped access to the rest. Use the loop variable so each HTTPS link maps to its own S3 URL, and add a unit test covering a granule with two protected HTTPS links. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a cloud-hosted granule only exposes HTTPS links and we fall back to guessing its S3 paths,
data_links(in_region=True)comes back with the first file repeated and the others missing. The cause is inDataGranule._derive_s3_link: the loop walks each HTTPS link, but it builds every S3 URL fromlinks[0]instead of the current link, so a granule with several files loses all but the first. I switched that line to use the loop variable so each HTTPS link maps to its own S3 URL.I added a unit test in
tests/unit/test_results.pythat builds a granule with two protected HTTPS links and checks they map to two distinct S3 URLs. It fails on the old code (the second link comes back as a duplicate of the first) and passes with the change. There's a CHANGELOG entry under Unreleased / Fixed.📚 Documentation preview 📚: https://earthaccess--1373.org.readthedocs.build/en/1373/