Skip to content

Fix RPM Registry 404 when package name contains 'package'#37087

Merged
lunny merged 8 commits into
go-gitea:mainfrom
Rohansguliani:fix-rpm-routing-main-37086
Apr 3, 2026
Merged

Fix RPM Registry 404 when package name contains 'package'#37087
lunny merged 8 commits into
go-gitea:mainfrom
Rohansguliani:fix-rpm-routing-main-37086

Conversation

@Rohansguliani
Copy link
Copy Markdown
Contributor

@Rohansguliani Rohansguliani commented Apr 2, 2026

Fixes #37086, fix the bug in MatchPath, and swap the order of overlapping routes in api.go to make it look better.

Swap the order of overlapping routes in api.go to prevent the short route from intercepting long paths when the name contains 'package'.

Fixes go-gitea#37086

Signed-off-by: Rohan Guliani <rohansguliani@google.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 2, 2026
Copy link
Copy Markdown
Member

@bircni bircni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is correct.
I would really like to see a Comment here to explain why we do this.
The root cause is still unfixed though.
The real issue is that <group:*> using (.*?) across / boundaries creates ambiguity with the literal package/ segment.
Also I think a test would be great for this to cover...

Signed-off-by: Rohan Guliani <rohansguliani@google.com>
@wxiaoguang
Copy link
Copy Markdown
Contributor

Good catch! Thank you very much.

btw: I think we can do more "fixes", I will do it, just a moment.

@wxiaoguang
Copy link
Copy Markdown
Contributor

It is a bug in "MatchPath", the generated regexp is ^/(.*?)/?package/([^/]+)/([^/]+)/([^/]+)$, will try to fix the root problem (if I can ...)

@wxiaoguang wxiaoguang marked this pull request as draft April 3, 2026 01:51
@wxiaoguang
Copy link
Copy Markdown
Contributor

Completely fixed in the framework.

// TODO: the MatchPath has been fixed, the order is not important anymore
// As long as the CI passes, we can remove the comments and the new test case (not needed anymore)

@wxiaoguang
Copy link
Copy Markdown
Contributor

Now, even if you swap the two MatchPath routes to old order, the test still passes. Everything should be right now.

Will do final clean up and mark it ready for review.

@wxiaoguang wxiaoguang marked this pull request as ready for review April 3, 2026 02:56
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 3, 2026
@wxiaoguang wxiaoguang added this to the 1.26.0 milestone Apr 3, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 3, 2026
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 3, 2026
@lunny lunny enabled auto-merge (squash) April 3, 2026 05:48
@lunny lunny merged commit 30c07c2 into go-gitea:main Apr 3, 2026
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 3, 2026
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 3, 2026
* main:
  Fix RPM Registry 404 when package name contains 'package' (go-gitea#37087)
  Improve actions notifier for `workflow_run` (go-gitea#37088)
  Refactor code render and render control chars (go-gitea#37078)
  Fix various problems (go-gitea#37077)
  [skip ci] Updated translations via Crowdin
  Support legacy run/job index-based URLs and refactor migration 326 (go-gitea#37008)
  Fix a bug when forking a repository in an organization (go-gitea#36950)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RPM Registry 404 when package name contains 'package'

5 participants