mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
9eb8743014
[CE/SP] Hotfix 4.1.6 GitOrigin-RevId: dc023665d5e0868913eff2104de1acaf7038cb9f
61 lines
1.5 KiB
Diff
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')
|
|
+ // })
|
|
}
|
|
|
|
/**
|