Skip to content

Commit

Permalink
fix(publisher-electron-release-server): set knownLength option for as…
Browse files Browse the repository at this point in the history
…set upload

ISSUES CLOSED: #2087
  • Loading branch information
monsterkrampe committed Feb 5, 2022
1 parent 9abc581 commit 01b8b43
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/publisher/electron-release-server/src/PublisherERS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ export default class PublisherERS extends PublisherBase<PublisherERSConfig> {

for (const makeResult of makeResults) {
const { packageJSON } = makeResult;
const artifacts = makeResult.artifacts
.filter((artifactPath) => path.basename(artifactPath).toLowerCase() !== 'releases');
const artifacts = makeResult.artifacts.filter((artifactPath) => path.basename(artifactPath).toLowerCase() !== 'releases');

const existingVersion = versions.find((version) => version.name === packageJSON.version);

Expand Down Expand Up @@ -132,7 +131,13 @@ export default class PublisherERS extends PublisherBase<PublisherERSConfig> {
artifactForm.append('token', token);
artifactForm.append('version', packageJSON.version);
artifactForm.append('platform', ersPlatform(makeResult.platform, makeResult.arch));
artifactForm.append('file', fs.createReadStream(artifactPath));

// see https://github.com/form-data/form-data/issues/426
const fileOptions = {
knownLength: fs.statSync(artifactPath).size,
};
artifactForm.append('file', fs.createReadStream(artifactPath), fileOptions);

await authFetch('api/asset', {
method: 'POST',
body: artifactForm,
Expand Down

0 comments on commit 01b8b43

Please sign in to comment.