Skip to content

Commit

Permalink
fix(admin-server): destroy s3 stream when user response stream is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 committed Jul 24, 2024
1 parent 106a5e9 commit 261f2a9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ee/admin-server/src/controllers/ProjectController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ export class ProjectController extends BaseController<ProjectParams> {
const processedHtml = this.preprocessIndexHtml(html, params)
res.end(processedHtml)
} else {
innerRes.Body.pipe(res)
if (res.closed) {
(innerRes.Body as Readable)?.destroy()
} else {
res.on('close', () => {
(innerRes.Body as Readable)?.destroy()
})
innerRes.Body.pipe(res)
}
}
} else {
res.writeHead(500)
Expand Down

0 comments on commit 261f2a9

Please sign in to comment.