Skip to content

fix(api): encode nested repository names in API paths - #1114

Open
anishmehta24 wants to merge 2 commits into
goharbor:mainfrom
anishmehta24:fix/nested-repo-path-encoding
Open

anishmehta24 wants to merge 2 commits into
goharbor:mainfrom
anishmehta24:fix/nested-repo-path-encoding

Conversation

@anishmehta24

Copy link
Copy Markdown

Description

Commands on a nested repository like library/team/app sent team%2Fapp in the path. Harbor wants the slash in repository_name encoded twice (team%252Fapp), so those requests never reach the repository route. The name is now escaped once before it goes to the go-client, which escapes it again.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation update
  • Chore / maintenance

Changes

  • Escape the repository name at the RepositoryName call sites in pkg/api (repository and artifact handlers)
  • New repository_handler_test.go checks the path sent to a local test server for nested and plain names

go test ./pkg/api/ passes.

Harbor expects a slash in the repository_name path parameter to be
encoded twice (a/b -> a%2Fb -> a%252Fb). The go-client escapes path
parameters only once, so commands on a nested repository such as
library/team/app sent team%2Fapp, which Harbor's nginx proxy decodes
back to team/app and the request never matches the repository route.

Escape the repository name once before handing it to the client.

Signed-off-by: Anish Mehta <mehtaanish111@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-12T22:15:56.905546Z 9edbfba PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply to a comment to ask cubic a question or push back. It learns from your replies.

Re-trigger cubic

Comment thread pkg/api/repository_handler_test.go
Signed-off-by: Anish Mehta <mehtaanish111@gmail.com>

@AdeshDeshmukh AdeshDeshmukh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nested repo goes out as team%2Fapp instead of team%252Fapp
Checked all 13 RepositoryName path sites, all covered, plain names unaffected (nginx control case passes).

test fails-before/passes-after on my end..vet/fmt clean.
lgtm.!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: artifact and repository commands don't encode nested repository names in the API path

2 participants