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
|
} 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
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-8in it's content type.The final condition in
getResponseData()to return a simpleArrayBufferis almost never reached because of thatrequest.js/src/fetch-wrapper.ts
Lines 168 to 172 in f7b9616
Reproduction:
See also octokit/rest.js#14
Versions
Octokit 4.1.2
Relevant log output
Code of Conduct