Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not encode / in ref names #1433

Merged
merged 4 commits into from
Feb 22, 2020
Merged

do not encode / in ref names #1433

merged 4 commits into from
Feb 22, 2020

Conversation

vetinari
Copy link
Contributor

fixes #1432

Signed-off-by: Hanno Hecker [email protected]

fixes google#1432

Signed-off-by: Hanno Hecker <[email protected]>
@googlebot googlebot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Feb 17, 2020
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @vetinari!

Before we merge this, can you please add unit test(s) that demonstrate the before/after effects of this change?

Also, please add a comment to the new refURLEscape function (even though it isn't exported) with text that shows what kind of URLs this function fixes.

this is not visible in the original tests, because the muxter uses url.Path
and not url.RawPath to match the route.
func refURLEscape(ref string) string {
parts := strings.Split(ref, "/")
for i, s := range parts {
parts[i] = url.QueryEscape(s)
parts[i] = url.PathEscape(s)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmmm... with this change from url.QueryEscape to url.PathEscape, I'm now concerned that we are breaking what was fixed in #1099.

Can you please add a unit test that demonstrates the URL found in #1099?

Unfortunately, I did not request that unit tests be added in #1099 to demonstrate the before/after changes. :-(
But I'm trying to fix that now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's one in #1118 (issue #1101). This still works, GetCommitSHA1() got the refURLEscape() also. I've added a test case for the original trailing % as given in #1099 where http.NewRequest was failing to parse the URL.

as given in the original google#1099
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @vetinari!
LGTM.

Awaiting second LGTM before merging.

Copy link
Collaborator

@wesleimp wesleimp left a comment

Choose a reason for hiding this comment

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

LGTM 👌

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 22, 2020

Thank you, @wesleimp!
Merging.

@gmlewis gmlewis merged commit cb1e3f4 into google:master Feb 22, 2020
n1lesh pushed a commit to n1lesh/go-github that referenced this pull request Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indication that the PR author has signed a Google Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refs should not encode /
4 participants