Skip to content

fix: Escape branch names when listing rules - #4534

Merged
gmlewis merged 1 commit into
google:masterfrom
nickita-khylkouski:fix/list-rules-branch-escape
Sep 10, 2026
Merged

gmlewis merged 1 commit into
google:masterfrom
nickita-khylkouski:fix/list-rules-branch-escape

Conversation

@nickita-khylkouski

Copy link
Copy Markdown
Contributor

hey, ListRulesForBranch puts the branch name straight into the URL, so a valid name like fix/#123-login gets truncated at #. literal % characters can also change the name or make URL parsing fail. this uses url.PathEscape(branch), like the other branch methods and #2948. added regression tests in repos_rules_test.go for ordinary names, slashes, #, and literal %, with and without pagination. BREAKING CHANGE: callers that already escape names as a workaround need to pass the raw branch name instead. this also applies to ListRulesForBranchIter. AI-assisted: ChatGPT helped investigate and draft the fix/tests. the isolated regression checks fail before the fix and pass after; full Go 1.26 repository checks are still pending.

Loading
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.

3 participants