Skip to content

CompareCommits() doesn't encode given base/head refs? #1642

@taisph

Description

@taisph

Our GitHub integration does a number of automated steps, one being comparing a PR branch with the base, to determine if it can be cleanly merged. It uses Repositories.CompareCommits() passing PullRequest.GetBase().GetRef() and PullRequest.GetHead().GetRef() as base and head refs.

Now, someone on our team thought it would be a great idea to name a branch "feature/#nnnn-some-task", causing the CompareCommits() call to request the URL "https://api.github.com/repos/owner/repo/compare/develop...feature/#nnnn-some-task" which gave an unexpected 404. Replacing the "#" with "%23" fixed this.

As a work around, I'm now doing this replacement before calling CompareCommits() but I think this should probably be handled by the library instead, as it has a better chance of knowing which characters should be encoded when talking to this part of the GitHub API.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions