-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Escape commit ref with percent encoding #1099
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @bgpat!
LGTM.
Awaiting second LGTM before merging.
I'm curious if there are other APIs in our repo where we have made the same mistake? I'm betting that anywhere we pass a While you are here, @bgpat, do you want to take a look? |
I found 9 same mistakes. I will fix it. $ grep -n Sprintf *.go | grep ', ref\W'
checks.go:258: u := fmt.Sprintf("repos/%v/%v/commits/%v/check-runs", owner, repo, ref)
checks.go:324: u := fmt.Sprintf("repos/%v/%v/commits/%v/check-suites", owner, repo, ref)
git_refs.go:60: u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
git_refs.go:91: u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
git_refs.go:211: u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, ref)
repos_commits.go:192: u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, ref)
repos_statuses.go:47: u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, ref)
repos_statuses.go:72: u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, ref)
repos_statuses.go:111: u := fmt.Sprintf("repos/%v/%v/commits/%v/status", owner, repo, ref) |
@gmlewis I escaped all |
OK, this is true awesomeness... thank you so much, @bgpat! Awaiting input from @gauntface as a sanity check to make sure my review makes sense... then we will get this in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me. We should look at adding some tests to make sure we don't regress on this in the future, but that can be done separately.
Thank you for fixing this :)
Excellent point, @gauntface! |
This is a bug fix. Bumping package version number to capture it. |
as given in the original google#1099
If
Repositories.GetCommitSHA1
was called with the branch name which includes non-alphabet character, it occurs an error. It looks to require escaping with percent encoding.Below is sample code:
before:
parse repos/bgpat/test/commits/cpu100%: invalid URL escape "%"
after:
46736bd30fe65160f7d21e49d8f23e4687abc41b