overleaf/server-ce/hotfix/4.1.6/patches/send+0.17.2.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

61 lines
1.5 KiB
Diff

diff --git a/node_modules/send/index.js b/node_modules/send/index.js
index 06d7507..8854216 100644
--- a/node_modules/send/index.js
+++ b/node_modules/send/index.js
@@ -795,31 +795,31 @@ SendStream.prototype.stream = function stream (path, options) {
// pipe
var stream = fs.createReadStream(path, options)
this.emit('stream', stream)
- stream.pipe(res)
-
- // response finished, done with the fd
- onFinished(res, function onfinished () {
- finished = true
- destroy(stream)
- })
-
- // error handling code-smell
- stream.on('error', function onerror (err) {
- // request already finished
- if (finished) return
-
- // clean up stream
- finished = true
- destroy(stream)
-
- // 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') } })
+
+ // // response finished, done with the fd
+ // onFinished(res, function onfinished () {
+ // finished = true
+ // destroy(stream)
+ // })
+ //
+ // // error handling code-smell
+ // stream.on('error', function onerror (err) {
+ // // request already finished
+ // if (finished) return
+ //
+ // // clean up stream
+ // finished = true
+ // destroy(stream)
+ //
+ // // error
+ // self.onStatError(err)
+ // })
+ //
+ // // end
+ // stream.on('end', function onend () {
+ // self.emit('end')
+ // })
}
/**