From fc80d8528b4d2daad23578159026dbdd9e2e15b5 Mon Sep 17 00:00:00 2001 From: Christopher Lee Date: Wed, 22 Jun 2022 18:53:25 -0600 Subject: [PATCH] fix: prevent infinite looping of overwriteArtifact --- packages/electron-publish/src/gitHubPublisher.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/electron-publish/src/gitHubPublisher.ts b/packages/electron-publish/src/gitHubPublisher.ts index 459c6351d4c..d306815abd7 100644 --- a/packages/electron-publish/src/gitHubPublisher.ts +++ b/packages/electron-publish/src/gitHubPublisher.ts @@ -198,12 +198,10 @@ export class GitHubPublisher extends HttpPublisher { requestProcessor ) .catch(e => { - if (this.doesErrorMeanAlreadyExists(e)) { - return this.overwriteArtifact(fileName, release).then(() => this.doUploadFile(attemptNumber, parsedUrl, fileName, dataLength, requestProcessor, release)) - } - if (attemptNumber > 3) { return Promise.reject(e) + } else if (this.doesErrorMeanAlreadyExists(e)) { + return this.overwriteArtifact(fileName, release).then(() => this.doUploadFile(attemptNumber + 1, parsedUrl, fileName, dataLength, requestProcessor, release)) } else { return new Promise((resolve, reject) => { const newAttemptNumber = attemptNumber + 1