Support GitHub Gist URLs via HTTP redirects in uv run#16451
Merged
charliermarsh merged 1 commit intoastral-sh:mainfrom Oct 29, 2025
twilligon:gist-redirect
Merged
Support GitHub Gist URLs via HTTP redirects in uv run#16451charliermarsh merged 1 commit intoastral-sh:mainfrom twilligon:gist-redirect
uv run#16451charliermarsh merged 1 commit intoastral-sh:mainfrom
twilligon:gist-redirect
Conversation
Extend the existing GitHub Gist URL support from #15058 to handle URLs that redirect to Gists. reqwest already handled generic URL redirects for us, i.e. uv run https://httpbin.org/redirect-to?url=https://gist.githubusercontent.com/twilligon/4d878a4d9550a4f1df258cde1f058699/raw/c28a4bf0cb6bb9e670cb47c95d28971ffac163e5/hello.py already worked. But uv run https://httpbin.org/redirect-to?url=https://gist.github.com/twilligon/4d878a4d9550a4f1df258cde1f058699 did not, nor did a bit.ly link leading to a Gist, etc. But if reqwest follows redirects *before* `resolve_gist_url`, we can handle this fine.
uv run
Contributor
Author
|
Thanks! |
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.
Summary
Extend the existing GitHub Gist URL support from #15058 to handle URLs that redirect to Gists.
reqwestalready handled generic URL redirects for us (note this redirects directly to the.pyongist.githubusercontent.com):But running a URL that redirected to a Gist's "main page" (a bit.ly link leading to a Gist, etc.) did not:
But if we have
reqwestfollow redirects beforeresolve_gist_url, we can handle this fine:Test Plan
I'd write an automated test but that'd require network access since wiremock doesn't seem to support mocking specific hostnames like
gist.github.com. As manual tests go, I basically did the above, testing with several redirectors to both generic and Gist URLs.