fix: use raw accept header in getContent to support CODEOWNERS files > 1 MB#15
Draft
Copilot wants to merge 2 commits into
Draft
fix: use raw accept header in getContent to support CODEOWNERS files > 1 MB#15Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
…up to 100 MB Add `accept: 'application/vnd.github.raw'` header to the `octokit.rest.repos.getContent` call so that the GitHub API returns file contents directly as a string instead of a base64-encoded object. This bypasses the ~1 MB API cap and supports files up to 100 MB, matching the 3 MB limit GitHub supports for CODEOWNERS files. Simplify the response-handling code accordingly (no base64 decoding needed) and update all tests to mock the raw string response format.
Copilot
AI
changed the title
[WIP] Fix request for raw file contents to handle large CODEOWNERS files
fix: use raw accept header in getContent to support CODEOWNERS files > 1 MB
Jun 20, 2026
aebrahim
approved these changes
Jun 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
octokit.rest.repos.getContentreturns base64-encoded content capped at ~1 MB, but GitHub supports CODEOWNERS files up to 3 MB. Using theapplication/vnd.github.rawaccept header bypasses that cap entirely (100 MB limit).src/main.tsheaders: { accept: 'application/vnd.github.raw' }to thegetContentcallresponse.datais the file content as a plain string — remove base64 decoding, encoding-type guard, and array/directory guard (directories now yield a GitHub API error caught by the existingcatchblock)__tests__/main.test.tsgetContentmocks from{ data: { content: b64(x), encoding: 'base64' } }to{ data: x }b64()helper