Repository navigation
fix: Escape branch names when listing rules - #4534
Merged
gmlewis merged 1 commit intoSep 10, 2026
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.