mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-11 23:12:20 -05:00
62 lines
1.5 KiB
Diff
62 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')
|
||
|
+ // })
|
||
|
}
|
||
|
|
||
|
/**
|