Skip to content

Commit

Permalink
fix: prevent infinite looping of overwriteArtifact during Github publ…
Browse files Browse the repository at this point in the history
…ishing (#6958)
  • Loading branch information
CCInc committed Jun 23, 2022
1 parent 4e90504 commit 8ffd9d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-crabs-prove.md
@@ -0,0 +1,5 @@
---
"electron-publish": patch
---

fix: prevent infinite error looping of overwriteArtifact during github artifact uploads
6 changes: 2 additions & 4 deletions packages/electron-publish/src/gitHubPublisher.ts
Expand Up @@ -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
Expand Down

0 comments on commit 8ffd9d4

Please sign in to comment.