Explorar el Código

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

This should fix a breakage in the template publishing workflow.
Ref: b70b837b7ba29b0631f3105ec1dd5f6cdebbd195
Shane Kilkelly hace 11 años
padre
commit
da5a538095

+ 5 - 6
services/filestore/app/coffee/FileHandler.coffee

@@ -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
-

+ 3 - 3
services/filestore/test/unit/coffee/FileHandlerTests.coffee

@@ -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)->