Skip to content

(fix) RepositoryContentsClient.GetArchive does not return the expected binary content#2803

Merged
kfcampbell merged 6 commits intooctokit:mainfrom
Jericho:getarchive
Oct 16, 2023
Merged

(fix) RepositoryContentsClient.GetArchive does not return the expected binary content#2803
kfcampbell merged 6 commits intooctokit:mainfrom
Jericho:getarchive

Conversation

@Jericho
Copy link
Contributor

@Jericho Jericho commented Oct 14, 2023

Resolves #2802


Before the change?

RepositoryContentsClient.GetArchive expects the result of the API call to contain a byte[] when in fact a stream is returned. This bug is due to a change introduced here.

After the change?

RepositoryContentsClient.GetArchive invokes Connection.GetRaw rather than Connection.Get<byte[]> in order to be the binary content of the response.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

  • Yes
  • No

To ensure that I was not introducing a breaking change, I created an overload of the existing GetRaw method to accept a timeout parameter. I could have added an additional parameter to the existing GetRaw method, but that would have been a breaking change. If you prefer the "additional-parameter-to-existing-method" rather than "overload-existing-method", I'll be happy to modifiy my PR.


This unit test currently fails which demonstrates the problem and it should pass when I am done with the PR
I debated adding an optional parameter for the timeout to the existing GetRaw method (which would be my personal preference) but it would be a breaking change and I doubt the Octokit team would be interested in such a change
… repo's archive content.

This ensure stream content are handled properly and solves the problem described in GitHub issue 2802
@Jericho Jericho changed the title Getarchive (fix) RepositoryContentsClient.GetArchive does not return the expected binary content Oct 14, 2023
Copy link
Contributor

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

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

I'm comfortable with the decision to overload here.

@kfcampbell kfcampbell merged commit 1eac831 into octokit:main Oct 16, 2023
@Jericho Jericho deleted the getarchive branch October 16, 2023 17:39
Lulalaby referenced this pull request in Fortunevale/ProjectMakoto Nov 1, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [Octokit](https://togithub.com/octokit/octokit.net) | `8.1.1` ->
`9.0.0` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/Octokit/9.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/Octokit/9.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/Octokit/8.1.1/9.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Octokit/8.1.1/9.0.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>octokit/octokit.net (Octokit)</summary>

###
[`v9.0.0`](https://togithub.com/octokit/octokit.net/releases/tag/v9.0.0)

##### What's Changed

##### Breaking changes

- Removes the .NET 5.0 support by
[@&#8203;nickfloyd](https://togithub.com/nickfloyd) in
[https://github.com/octokit/octokit.net/pull/2806](https://togithub.com/octokit/octokit.net/pull/2806)

##### Features

- \[feat]: Add RenameBranch method to RepositoryBranchesClient by
[@&#8203;dirtygooback](https://togithub.com/dirtygooback) in
[https://github.com/octokit/octokit.net/pull/2799](https://togithub.com/octokit/octokit.net/pull/2799)

##### Fixes

- (fix) RepositoryContentsClient.GetArchive does not return the expected
binary content by [@&#8203;Jericho](https://togithub.com/Jericho) in
[https://github.com/octokit/octokit.net/pull/2803](https://togithub.com/octokit/octokit.net/pull/2803)

##### Maintenance

- build(deps): bump xunit.runner.visualstudio from 2.5.1 to 2.5.3 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/octokit/octokit.net/pull/2805](https://togithub.com/octokit/octokit.net/pull/2805)
- build(deps): bump xunit from 2.5.1 to 2.5.3 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/octokit/octokit.net/pull/2804](https://togithub.com/octokit/octokit.net/pull/2804)

##### New Contributors

- [@&#8203;Jericho](https://togithub.com/Jericho) made their first
contribution in
[https://github.com/octokit/octokit.net/pull/2803](https://togithub.com/octokit/octokit.net/pull/2803)

**Full Changelog**:
octokit/octokit.net@v8.1.1...v9.0.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/Fortunevale/ProjectMakoto).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMS41IiwidXBkYXRlZEluVmVyIjoiMzcuMzEuNSIsInRhcmdldEJyYW5jaCI6ImRldiJ9-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG]: RepositoryContentsClient.GetArchive does not return the expected binary content

2 participants