-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Labels
Type: BugSomething isn't working as documentedSomething isn't working as documented
Description
What happened?
It seems that ever since the very beginning of this project, it has been naively converting every file to text that has charset=utf-8
in it's content type.
The final condition in getResponseData()
to return a simple ArrayBuffer
is almost never reached because of that
request.js/src/fetch-wrapper.ts
Lines 168 to 172 in f7b9616
} else if ( | |
mimetype.type.startsWith("text/") || | |
mimetype.parameters.charset?.toLowerCase() === "utf-8" | |
) { | |
return response.text().catch(() => ""); |
Reproduction:
import { Octokit } from "octokit";
const octokit = new Octokit({
auth: "<token>"
});
const response = await octokit.rest.repos.getContent({
owner: "wolfy1339",
repo: "test-repository-test",
path: "training.opus",
mediaType: {
format: "raw"
}
});
console.log(request.data); // Mangled binary data
See also octokit/rest.js#14
Versions
Octokit 4.1.2
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type: BugSomething isn't working as documentedSomething isn't working as documented
Type
Projects
Status
🔥 Backlog