mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-09 11:35:47 +00:00
null check stat when we check file on disk
https://sentry.io/sharelatex-1/sl-web-server-prod/issues/125814174/
This commit is contained in:
parent
9a8ee112a5
commit
d453a4d5c7
2 changed files with 10 additions and 0 deletions
|
@ -13,6 +13,9 @@ module.exports = FileStoreHandler =
|
|||
if err?
|
||||
logger.err err:err, project_id:project_id, file_id:file_id, fsPath:fsPath, "error stating file"
|
||||
callback(err)
|
||||
if !stat?
|
||||
logger.err project_id:project_id, file_id:file_id, fsPath:fsPath, "stat is not available, can not check file from disk"
|
||||
return callback(new Error("error getting stat, not available"))
|
||||
if !stat.isFile()
|
||||
logger.log project_id:project_id, file_id:file_id, fsPath:fsPath, "tried to upload symlink, not contining"
|
||||
return callback(new Error("can not upload symlink"))
|
||||
|
|
|
@ -96,6 +96,13 @@ describe "FileStoreHandler", ->
|
|||
@fs.createReadStream.called.should.equal false
|
||||
done()
|
||||
|
||||
describe "symlink", ->
|
||||
it "should not read file stat returns nothing", (done)->
|
||||
@fs.lstat = sinon.stub().callsArgWith(1, null, null)
|
||||
@handler.uploadFileFromDisk @project_id, @file_id, @fsPath, =>
|
||||
@fs.createReadStream.called.should.equal false
|
||||
done()
|
||||
|
||||
describe "when upload fails", ->
|
||||
beforeEach ->
|
||||
@writeStream.on = (type, cb) ->
|
||||
|
|
Loading…
Add table
Reference in a new issue