overleaf/server-ce/hotfix/4.1.6/patches/express++send+0.18.0.patch
Miguel Serrano 9eb8743014 Merge pull request #15531 from overleaf/msm-sp-hotfix-4-1-6
[CE/SP] Hotfix 4.1.6

GitOrigin-RevId: dc023665d5e0868913eff2104de1acaf7038cb9f
2023-11-02 08:53:07 +00:00

57 lines
1.4 KiB
Diff

diff --git a/node_modules/express/node_modules/send/index.js b/node_modules/express/node_modules/send/index.js
index 89afd7e..de56daf 100644
--- a/node_modules/express/node_modules/send/index.js
+++ b/node_modules/express/node_modules/send/index.js
@@ -789,29 +789,29 @@ SendStream.prototype.stream = function stream (path, options) {
// pipe
var stream = fs.createReadStream(path, options)
this.emit('stream', stream)
- stream.pipe(res)
-
- // cleanup
- function cleanup () {
- destroy(stream, true)
- }
-
- // response finished, cleanup
- onFinished(res, cleanup)
-
- // error handling
- stream.on('error', function onerror (err) {
- // clean up stream early
- cleanup()
-
- // error
- self.onStatError(err)
- })
-
- // end
- stream.on('end', function onend () {
- self.emit('end')
- })
+ Stream.pipeline(stream, res, err => { if (err) { self.onStatError(err) } else { self.emit('end') } })
+
+ // // cleanup
+ // function cleanup () {
+ // destroy(stream, true)
+ // }
+ //
+ // // response finished, cleanup
+ // onFinished(res, cleanup)
+ //
+ // // error handling
+ // stream.on('error', function onerror (err) {
+ // // clean up stream early
+ // cleanup()
+ //
+ // // error
+ // self.onStatError(err)
+ // })
+ //
+ // // end
+ // stream.on('end', function onend () {
+ // self.emit('end')
+ // })
}
/**