Skip to content

Previously registered incorrect redirects will manifest starting with v1.25. #36026

@cp-20

Description

@cp-20

Description

We have been using Gitea for a long time. About seven years ago, we renamed a repository from owner/repo to owner/legacy_repo. Later, we created a repository named owner/repo. Since then, we have been working with owner/repo. However, starting with v1.25, a bug occurred where connecting via SSH caused owner/repo to be redirected to owner/legacy_repo.

Upon investigating the cause, we found that an incorrect redirect from owner/repo to owner/legacy_repo was registered in the repo_redirect table. This issue became apparent due to changes in v1.25 (#35416). We are unsure why the incorrect redirect was registered in the repo_redirect table, but we resolved it with the following workaround.

DELETE FROM repo_redirect WHERE EXISTS (SELECT id FROM repository WHERE owner_id = repo_redirect.owner_id AND lower_name = repo_redirect.lower_name);

You can check if there are any incorrect redirects using the following SQL:

SELECT * FROM repo_redirect WHERE EXISTS (SELECT id FROM repository WHERE owner_id = repo_redirect.owner_id AND lower_name = repo_redirect.lower_name);

Please consider adding a feature (or DB migration) to Gitea that detects and removes such incorrect redirects. Or implementing logics like searching repository first from the repositories and then redirects.

NOTE: any operation via HTTPS is working fine.

Gitea Version

v1.25

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

via docker

Database

MySQL/MariaDB

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions