-
Notifications
You must be signed in to change notification settings - Fork 122
Relative self hrefs break link resolution #574
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
Relative self hrefs break link resolution #574
Conversation
I've come up with a "strong as possible" solution by gating Lines 137 to 138 in 76ef6a3
The test breaks because the self href is turned into an absolute one by this PR. This test case is labelled "special case" by @schwehr (https://github.com/stac-utils/pystac/blame/76ef6a3b9bc3412cfcbc7f502d8fc1f56310b779/tests/test_link.py#L137-L138). What was the special case that necessitated this test? |
I wish I knew what was weird about the handling of |
Looking back at the commit that added that comment it looks like the only thing that was special about that case is the fact that "self" links were always turned into absolute links (there is a test case later on in that commit that tests for this, but it looks like it has been removed since then). I'm in favor of updating this test to reflect the changes in this PR. |
Codecov Report
@@ Coverage Diff @@
## main #574 +/- ##
==========================================
+ Coverage 94.67% 94.69% +0.02%
==========================================
Files 75 75
Lines 10732 10776 +44
Branches 1048 1053 +5
==========================================
+ Hits 10160 10204 +44
Misses 396 396
Partials 176 176
Continue to review full report at Codecov.
|
It's relative, so kinda weird anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor type annotation change (that I think was actually introduced in an earlier PR...), but otherwise looks good to me. Thanks for the fix!
Related Issue(s): #571
Description: Items created from relative paths can have relative self links, which breaks assumptions about self hrefs. Here's one place where the self href is assumed to be absolute:
pystac/pystac/link.py
Lines 234 to 242 in 76ef6a3
I did confirm that the issue was present in https://github.com/stac-utils/pystac/releases/tag/v1.0.0-rc.3, which means that #555 is likely not the cause (we thought it might be since it did muck around with how links worked).
Opening as a draft b/c it's just a failing test right now, will convert to a real pull request when there's a resolution.PR Checklist:
pre-commit run --all-files
)scripts/test
)