|
@@ -11,7 +11,7 @@ describe "FileStoreHandler", ->
|
|
|
@fs =
|
|
@fs =
|
|
|
createReadStream : sinon.stub()
|
|
createReadStream : sinon.stub()
|
|
|
lstat: sinon.stub().callsArgWith(1, null, {
|
|
lstat: sinon.stub().callsArgWith(1, null, {
|
|
|
- isFile:=> @isSafeOnFileSystem
|
|
|
|
|
|
|
+ isFile:=> true
|
|
|
isDirectory:-> return false
|
|
isDirectory:-> return false
|
|
|
})
|
|
})
|
|
|
@writeStream =
|
|
@writeStream =
|
|
@@ -35,7 +35,6 @@ describe "FileStoreHandler", ->
|
|
|
describe "uploadFileFromDisk", ->
|
|
describe "uploadFileFromDisk", ->
|
|
|
beforeEach ->
|
|
beforeEach ->
|
|
|
@request.returns(@writeStream)
|
|
@request.returns(@writeStream)
|
|
|
- @isSafeOnFileSystem = true
|
|
|
|
|
|
|
|
|
|
it "should create read stream", (done)->
|
|
it "should create read stream", (done)->
|
|
|
@fs.createReadStream.returns
|
|
@fs.createReadStream.returns
|
|
@@ -91,8 +90,13 @@ describe "FileStoreHandler", ->
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
describe "symlink", ->
|
|
describe "symlink", ->
|
|
|
|
|
+ beforeEach ->
|
|
|
|
|
+ @fs.lstat = sinon.stub().callsArgWith(1, null, {
|
|
|
|
|
+ isFile:=> false
|
|
|
|
|
+ isDirectory:-> return false
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
it "should not read file if it is symlink", (done)->
|
|
it "should not read file if it is symlink", (done)->
|
|
|
- @isSafeOnFileSystem = false
|
|
|
|
|
@handler.uploadFileFromDisk @project_id, @file_id, @fsPath, =>
|
|
@handler.uploadFileFromDisk @project_id, @file_id, @fsPath, =>
|
|
|
@fs.createReadStream.called.should.equal false
|
|
@fs.createReadStream.called.should.equal false
|
|
|
done()
|
|
done()
|