Skip to content

fix(results): derive each S3 link from its own HTTPS link#1373

Open
arpitjain099 wants to merge 3 commits into
earthaccess-dev:mainfrom
arpitjain099:chore/s3-link-per-link
Open

fix(results): derive each S3 link from its own HTTPS link#1373
arpitjain099 wants to merge 3 commits into
earthaccess-dev:mainfrom
arpitjain099:chore/s3-link-per-link

Conversation

@arpitjain099

@arpitjain099 arpitjain099 commented Jun 30, 2026

Copy link
Copy Markdown

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 in DataGranule._derive_s3_link: the loop walks each HTTPS link, but it builds every S3 URL from links[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.py that 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/

_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>
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

Binder 👈 Launch a binder notebook on this branch for commit ba79b72

I will automatically update this comment whenever this PR is modified

Binder 👈 Launch a binder notebook on this branch for commit 2f50ff6

Binder 👈 Launch a binder notebook on this branch for commit 7a20fc8

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.

1 participant