Skip to content

fix: handle projects with multi-level namespaces#3092

Merged
centosinfra-prod-github-app[bot] merged 1 commit intopackit:mainfrom
xingzihai:fix-multi-level-namespaces
Apr 10, 2026
Merged

fix: handle projects with multi-level namespaces#3092
centosinfra-prod-github-app[bot] merged 1 commit intopackit:mainfrom
xingzihai:fix-multi-level-namespaces

Conversation

@xingzihai
Copy link
Copy Markdown
Contributor

Summary

This PR fixes an issue with handling projects that have multi-level namespaces.

Problem

The API routes were using <namespace> which doesn't match multi-level namespaces like organization/team or org/suborg/project.

Solution

Changed the route pattern from <namespace> to <path:namespace> which allows matching namespaces with slashes (multi-level namespaces).

Changes

  • Updated API routes in projects.py to use <path:namespace>
  • Updated API routes in usage.py to use <path:namespace>

Testing

  • Tested with single-level namespaces (existing behavior preserved)
  • Tested with multi-level namespaces (now works correctly)

Example

Before: /github/org/team/repo would fail to match
After: /github/org/team/repo correctly matches with namespace=org/team

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates several API routes in projects.py and usage.py to use the path converter for the namespace parameter. This change enables support for multi-level namespaces that contain slashes, which is necessary for forges like GitLab. I have no feedback to provide.

@centosinfra-prod-github-app
Copy link
Copy Markdown
Contributor

@mfocko mfocko self-assigned this Apr 9, 2026
Copy link
Copy Markdown
Member

@mfocko mfocko left a comment

Choose a reason for hiding this comment

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

LGTM

@mfocko mfocko force-pushed the fix-multi-level-namespaces branch from 9d6dc44 to 32da30f Compare April 10, 2026 09:51
@centosinfra-prod-github-app
Copy link
Copy Markdown
Contributor

Flask-RESTX routes were using <namespace> which doesn't match
paths containing slashes (like multi-level GitLab namespaces).

This fix converts all <namespace> route parameters to <path:namespace>
using Flask's path converter, which correctly matches paths with slashes.

Example: gitlab.com/cki-project/contrib/kwf-lib is now correctly parsed:
- forge: gitlab.com
- namespace: cki-project/contrib
- repo_name: kwf-lib

Files modified:
- packit_service/service/api/projects.py (6 routes)
- packit_service/service/api/usage.py (1 route)

Fixes: packit#3063
@mfocko mfocko force-pushed the fix-multi-level-namespaces branch from 32da30f to 29aa1c5 Compare April 10, 2026 10:05
@centosinfra-prod-github-app
Copy link
Copy Markdown
Contributor

@mfocko mfocko added the mergeit Merge via Zuul label Apr 10, 2026
@centosinfra-prod-github-app
Copy link
Copy Markdown
Contributor

@centosinfra-prod-github-app centosinfra-prod-github-app bot merged commit c4fc635 into packit:main Apr 10, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in Packit pull requests Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mergeit Merge via Zuul

Projects

Development

Successfully merging this pull request may close these issues.

3 participants