Skip to content

Commit

Permalink
fix: github release uploads (#302)
Browse files Browse the repository at this point in the history
The upload requires binary data not strings.  Unfortunately the typing
information in the generated octokit typings is wrong about this.

Passing a string here creates invalid binary uploads and has caused an
incident at Sentry that caused invalid uploads.
  • Loading branch information
mitsuhiko authored Oct 1, 2021
1 parent 6d56676 commit 4697dbd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/targets/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,10 @@ export class GithubTarget extends BaseTarget {
const name = basename(path);
const params = {
...this.githubConfig,
data: readFileSync(path, { encoding: 'binary' }),
// so note here. Octokit types this out as string, but in fact it also
// accepts a `Buffer` here. In fact passing a string is not what we want
// as we upload binary data.
data: readFileSync(path) as any,
headers: {
'Content-Length': stats.size,
'Content-Type': contentTypeProcessed,
Expand Down

0 comments on commit 4697dbd

Please sign in to comment.