-
Notifications
You must be signed in to change notification settings - Fork 706
Allow github:ORG//
repos to redirect to other repos in the same org
#4159
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
base: master
Are you sure you want to change the base?
Conversation
922958f
to
dca4917
Compare
Signed-off-by: Jan Dubois <[email protected]>
dca4917
to
fd9801a
Compare
On second though the "CORS" restriction may not make much sense for GitHub URLs, as a |
It is not so surprising once you realize that all forks are part of the same repo on the server side, and serve simply as namespaces for branch and tag names. This is also the reason GitHub does not allow public forks of private repos. Because if the SHA1 of a private commit is leaked, it becomes accessible through the public fork. I already mentioned before that we don't restrict redirects on http:// and https:// URLs either, so it is a little odd to have them on github: URLs. But I think the use case is really to redirect from the github:ORG// repo to a different place in the same ORG, not to be a generic link redirector. I can remove the restriction, if you want; I don't think it matters much either way. But we can also remove the restriction later, once an actual use case for cross-org linking has appeared. |
While working on the tests for this PR I tripped myself a few times over the problem that except for the root redirect of ❯ l tmpl url github:jandubois//redirect
https://raw.githubusercontent.com/jandubois/jandubois/main/redirect.yaml
❯ l tmpl url github:jandubois//redirect/
https://raw.githubusercontent.com/jandubois/lima/master/templates/default.yaml Without the trailing slash If I can accidentally forget to add the slash while working on the tests, then it is very likely that casual users will also run into it1. I think we can do 2 things to mitigate it:
I think (2) is more useful than (1), but if we do (2) and already fetch the file, then we can just do (1) at the same time at no extra cost. It is just a fallback when I think we should implement both (1) and (2). For consistency we should probably also implement them for non-ORG repos, but of course they would only allow symlinks and not redirects to other repos. This should again be done in a separate PR because this one is already big enough. But let me know what you think first! Footnotes
|
I'd rather expect |
That's what it does. You are seeing the effect of the redirect from there: ❯ curl https://raw.githubusercontent.com/jandubois/jandubois/main/redirect/.lima.yaml
github:jandubois/lima/templates/default The discussion above is just about URLs without a trailing slash like Currently only I think directories without trailing slashes should be able to redirect as well because it is easy to forget to add one, just like people forget to add one to Either way, that should be a separate PR from this one. |
SGTM.
This restriction sounds confusing |
See #4134 (comment) for background.
Regarding #4134 (comment), it is now possible to implement this yourself, if you want to: