Repository navigation
fix: keep query and fragment in relative URL hrefs - #1868
Merged
Merged
Conversation
make_relative_href dropped the query string and fragment of the source when both hrefs were URLs on the same host, so a signed asset href such as .../data.tif?sig=abc lost its token after make_asset_hrefs_relative() and could not be recovered by make_asset_hrefs_absolute(). _make_absolute_href_url already carries the source query and fragment through; do the same in _make_relative_href_url.
jsignell
self-requested a review
December 1, 2026 15:38
jsignell
enabled auto-merge
December 1, 2026 15:45
jsignell
disabled auto-merge
December 1, 2026 16:49
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.
Related Issue(s):
Description:
make_relative_hrefdrops the query string and fragment of the source href when both hrefs are URLs with the same scheme and host:So an item whose asset href is a signed URL loses the token on
make_asset_hrefs_relative()(or when saving a self-contained catalog), andmake_asset_hrefs_absolute()can't bring it back. The other direction already keeps it:_make_absolute_href_urlpasses the sourceparams,queryandfragmentthroughurlunparse. This does the same in_make_relative_href_url, so the example above now gives./data/i.tif?sig=abcand round-trips back to the original href.Local file paths are not touched.
Added two cases (query and fragment) to the
test_make_relative_hrefparametrization; both fail onmainand pass with the change.PR Checklist:
pre-commit run --all-files)pytest): 1564 passed, 18 skipped locally