mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
fixed bug where file uploader was calling cb on read stream not write stream, race condition created.
This commit is contained in:
parent
b46f320882
commit
65f849aad0
2 changed files with 6 additions and 2 deletions
|
@ -13,7 +13,7 @@ module.exports =
|
||||||
uri: @_buildUrl(project_id, file_id)
|
uri: @_buildUrl(project_id, file_id)
|
||||||
writeStream = request(opts)
|
writeStream = request(opts)
|
||||||
readStream.pipe writeStream
|
readStream.pipe writeStream
|
||||||
readStream.on "end", callback
|
writeStream.on "end", callback
|
||||||
readStream.on "error", (err)->
|
readStream.on "error", (err)->
|
||||||
logger.err err:err, project_id:project_id, file_id:file_id, fsPath:fsPath, "something went wrong on the read stream of uploadFileFromDisk"
|
logger.err err:err, project_id:project_id, file_id:file_id, fsPath:fsPath, "something went wrong on the read stream of uploadFileFromDisk"
|
||||||
callback err
|
callback err
|
||||||
|
|
|
@ -10,7 +10,11 @@ describe "FileStoreHandler", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@fs =
|
@fs =
|
||||||
createReadStream : sinon.stub()
|
createReadStream : sinon.stub()
|
||||||
@writeStream = {my:"writeStream", on:->}
|
@writeStream =
|
||||||
|
my:"writeStream"
|
||||||
|
on: (type, cb)->
|
||||||
|
if type == "end"
|
||||||
|
cb()
|
||||||
@readStream = {my:"readStream"}
|
@readStream = {my:"readStream"}
|
||||||
@request = sinon.stub()
|
@request = sinon.stub()
|
||||||
@settings = apis:{filestore:{url:"http//filestore.sharelatex.test"}}
|
@settings = apis:{filestore:{url:"http//filestore.sharelatex.test"}}
|
||||||
|
|
Loading…
Reference in a new issue