-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
RepositoriesClient.GetAllPublic() fails on GitHub Enterprise due to incorrect endpoint Uri #1204
Conversation
40a63f0
to
44df426
Compare
I'm a bit 👎 on the guard clause as-is but I'll sleep on it - or we can discuss it in a separate PR. Everything else is 💎 |
I'm not a huge fan of the guard either... but given that we aren't running integration tests against github enterprise it pretty much means that we could break any "normal" call from working against GHE if we miss that innocuous leading slash when reviewing PRs. Other things I considered were doing something in the Then we have the other situation of any consumers of octokit that are using the But yeah my main concern was the fact we can inadvertently break API methods from working on Enterprise and it doesnt get picked up in tests or at runtime. We could throw an exception I guess (again, that's too late if we've shipped the release though!). So that's how I came to the conclusion that there doesnt seem to be a reason NOT to trim leading slashes off. The check that it isnt an AboluteUri is needed because when dealing with multple paginated calls, the subsequent requests have the full absolute Uri in the endpoint... |
@ryangribble I'd love to script out something so we can verify all these URIs are correctly formatted, rather that bake that behaviour into |
…base address to have the /api/v3/ removed when talking to GHE???
…cting full Uri" This reverts commit 44df426.
44df426
to
b99d178
Compare
OK ive reverted the change in Will raise a new issue for the
part... |
@ryangribble thanks! |
release_notes: |
Due to shenanigans with the way dotnet joins
Uri
objects together, if any relativeUri
endpoint starts with a leading slash, this "wipes out" the/api/v3/
component of theBaseAddress
for GitHub Enterprise.There were 2 occurrences of endpoint Uri's being set in
ApiUrls
helper class that had incorrect leading slashes on them, causing these calls (both forRepositoriesClient.GetAllPublic()
) to return HTTP 406 "NotAccepted" errors when run against GitHub Enterprise due to the Url being incorrect. These have now been corrected.Additionally I have added a safety in
HttpClientAdapter
class, when constructing the full uri, to trim any leading slashes off relative Uri endpoint before joining it toBaseAddress
.@shiftkey is this OK or is there another way you'd prefer to guard against this?