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

Add the ability to download raw file, needed when size > 1MB #1075

Merged
merged 3 commits into from
Aug 15, 2022

Conversation

genintho
Copy link
Contributor

@genintho genintho commented Jul 6, 2022

API DOC https://docs.github.com/en/rest/repos/contents

The API call to return the content of a file return an empty content if a file is bigger than 1MB.
To be able to download that file, we need to provide the header application/vnd.github.VERSION.raw.
When doing so, the API return a the raw file, instead of a JSON object with some attributes + the file content.

Because the API has a different behavior, I preferred to create a dedicated method as opposed to provide accept more option in the download method and having a bunch of if/else.

Note: a 3rd behavior exists for that API call when downloading markdown and passing the application/vnd.github.VERSION.html header, which is not supported by this code change.

Copy link
Collaborator

@acrobat acrobat left a comment

Choose a reason for hiding this comment

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

Changes look good 👌 Can you just apply the suggested codestyle changes of the sttyleci check? Thanks!

@genintho genintho requested a review from acrobat August 11, 2022 10:00
@acrobat acrobat merged commit 0158c30 into KnpLabs:master Aug 15, 2022
@acrobat
Copy link
Collaborator

acrobat commented Aug 15, 2022

Thank you @genintho

@acrobat acrobat removed their request for review August 15, 2022 13:36
@genintho
Copy link
Contributor Author

Would it be possible to get a release with this change? Thank you!

@genintho genintho deleted the genintho-content-request-headers branch August 26, 2022 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants