Skip to content
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

Redirect Repo URLs on User/Org rename #17655

Closed
silverwind opened this issue Nov 15, 2021 · 3 comments · Fixed by #21398
Closed

Redirect Repo URLs on User/Org rename #17655

silverwind opened this issue Nov 15, 2021 · 3 comments · Fixed by #21398
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@silverwind
Copy link
Member

silverwind commented Nov 15, 2021

Feature Description

If a repo is renamed, the old repo URL will redirect to the new one. This feature is not present when a user or org is being renamed, while it would definitely be nice to have to allow an easy transition to the new URL.

Edit: Did some testing: Redirects on the user/org pages are already present, they are just missing for the repos.

@silverwind silverwind added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Nov 15, 2021
@silverwind silverwind changed the title Redirect on User/Org rename Redirect Repos on User/Org rename Nov 15, 2021
@silverwind silverwind changed the title Redirect Repos on User/Org rename Redirect Repo URLs on User/Org rename Nov 15, 2021
@lunny
Copy link
Member

lunny commented Nov 16, 2021

The feature is similar as UserRedirect but could be named RepoRedirect.

  • when rename a repo, add a new record into table repo_redirect
  • when visit a repo, if repo is not exist, then try to get the new location from repo_redirect, if there is not, then try to get the new user from user_redirect and try to get new repo which has new user name but requested reponame.
  • when creating a new repository, the same repo path must be removed from table repo_redirect
  • when delete a repository, the records on repo_redirect should be deleted

@silverwind
Copy link
Member Author

silverwind commented Nov 16, 2021

Would it interfere with the existing repo redirect mechanism that triggers on repo rename? I did not check the code, but maybe we could re-use part of that system and additionally trigger it on user/org rename.

@lunny
Copy link
Member

lunny commented Nov 16, 2021

Yes, the userredirect should be also considered. I have updated my above comment.

@wxiaoguang wxiaoguang linked a pull request Oct 10, 2022 that will close this issue
wxiaoguang pushed a commit that referenced this issue Oct 11, 2022
Fixes #17655

If you rename `user1` to `user2` and visit `/user1` you get redirected
to `/user2`. But if you visit `/user1/repo` you just get a 404 error.
With this PR the user is redirected to `/user2/repo`.
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants