mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
use 'response' to send 'NoSuchKey' when local file is not found
This commit is contained in:
parent
8744cf94a5
commit
7d96f3aadd
2 changed files with 8 additions and 2 deletions
|
@ -2,6 +2,7 @@ logger = require("logger-sharelatex")
|
|||
fs = require("fs")
|
||||
LocalFileWriter = require("./LocalFileWriter")
|
||||
rimraf = require("rimraf")
|
||||
response = require ("response")
|
||||
|
||||
filterName = (key) ->
|
||||
return key.replace /\//g, "_"
|
||||
|
@ -32,8 +33,12 @@ module.exports =
|
|||
sourceStream = fs.createReadStream "#{location}/#{filteredName}"
|
||||
sourceStream.on 'error', (err) ->
|
||||
logger.err err:err, location:location, name:name, "Error reading from file"
|
||||
callback err
|
||||
callback null,sourceStream
|
||||
if err.code = 'ENOENT'
|
||||
callback null, response().html('NoSuchKey: file not found\n')
|
||||
else
|
||||
callback err
|
||||
sourceStream.on 'readable', () ->
|
||||
callback null, sourceStream
|
||||
|
||||
|
||||
copyFile: (location, fromName, toName, callback = (err)->)->
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
"node-uuid": "~1.4.1",
|
||||
"pngcrush": "0.0.3",
|
||||
"request": "2.14.0",
|
||||
"response": "0.14.0",
|
||||
"rimraf": "2.2.8",
|
||||
"settings-sharelatex": "git+https://github.com/sharelatex/settings-sharelatex.git#master",
|
||||
"stream-buffers": "~0.2.5",
|
||||
|
|
Loading…
Reference in a new issue