Fix calls to PersistorManager.getFileStream which were missed in initial refactor.

This should fix a breakage in the template publishing workflow.
Ref: b70b837b7ba29b0631f3105ec1dd5f6cdebbd195
This commit is contained in:
Shane Kilkelly 2015-09-08 09:23:08 +01:00
parent 9b8f11f517
commit da5a538095
2 changed files with 8 additions and 9 deletions

View file

@ -39,7 +39,7 @@ module.exports =
convetedKey = KeyBuilder.addCachingToKey(key, opts)
PersistorManager.checkIfFileExists bucket, convetedKey, (err, exists)=>
if exists
PersistorManager.getFileStream bucket, convetedKey, callback
PersistorManager.getFileStream bucket, convetedKey, opts, callback
else
@_getConvertedFileAndCache bucket, key, convetedKey, opts, callback
@ -58,10 +58,10 @@ module.exports =
], (err)->
if err?
return callback(err)
PersistorManager.getFileStream bucket, convetedKey, callback
PersistorManager.getFileStream bucket, convetedKey, opts, callback
_convertFile: (bucket, origonalKey, opts, callback)->
@_writeS3FileToDisk bucket, origonalKey, (err, origonalFsPath)->
@_writeS3FileToDisk bucket, origonalKey, opts, (err, origonalFsPath)->
done = (err, destPath)->
if err?
logger.err err:err, bucket:bucket, origonalKey:origonalKey, opts:opts, "error converting file"
@ -79,7 +79,6 @@ module.exports =
throw new Error("should have specified opts to convert file with #{JSON.stringify(opts)}")
_writeS3FileToDisk: (bucket, key, callback)->
PersistorManager.getFileStream bucket, key, (err, fileStream)->
_writeS3FileToDisk: (bucket, key, opts, callback)->
PersistorManager.getFileStream bucket, key, opts, (err, fileStream)->
LocalFileWriter.writeStream fileStream, key, callback

View file

@ -135,7 +135,7 @@ describe "FileHandler", ->
it "should getFileStream if it does exists", (done)->
@PersistorManager.checkIfFileExists.callsArgWith(2, null, true)
@PersistorManager.getFileStream.callsArgWith(2)
@PersistorManager.getFileStream.callsArgWith(3)
@handler._getConvertedFile @bucket, @key, {}, =>
@PersistorManager.getFileStream.calledWith(@bucket).should.equal true
done()
@ -152,7 +152,7 @@ describe "FileHandler", ->
it "should _convertFile ", (done)->
@stubbedStream = {"something":"here"}
@PersistorManager.sendFile = sinon.stub().callsArgWith(3)
@PersistorManager.getFileStream = sinon.stub().callsArgWith(2, null, @stubbedStream)
@PersistorManager.getFileStream = sinon.stub().callsArgWith(3, null, @stubbedStream)
@convetedKey = @key+"converted"
@handler._convertFile = sinon.stub().callsArgWith(3, null, @stubbedPath)
@ImageOptimiser.compressPng = sinon.stub().callsArgWith(1)
@ -169,7 +169,7 @@ describe "FileHandler", ->
@FileConverter.convert.callsArgWith(2, null, @formattedStubbedPath)
@FileConverter.thumbnail.callsArgWith(1, null, @formattedStubbedPath)
@FileConverter.preview.callsArgWith(1, null, @formattedStubbedPath)
@handler._writeS3FileToDisk = sinon.stub().callsArgWith(2, null, @stubbedPath)
@handler._writeS3FileToDisk = sinon.stub().callsArgWith(3, null, @stubbedPath)
@LocalFileWriter.deleteFile.callsArgWith(1)
it "should call thumbnail on the writer path if style was thumbnail was specified", (done)->