Repository navigation
fix(api): encode nested repository names in API paths - #1114
anishmehta24 wants to merge 2 commits into
Conversation
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>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
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
Signed-off-by: Anish Mehta <mehtaanish111@gmail.com>
AdeshDeshmukh
left a comment
There was a problem hiding this comment.
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.!
Description
Commands on a nested repository like
library/team/appsentteam%2Fappin the path. Harbor wants the slash inrepository_nameencoded 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
Changes
RepositoryNamecall sites inpkg/api(repository and artifact handlers)repository_handler_test.gochecks the path sent to a local test server for nested and plain namesgo test ./pkg/api/passes.