Fix the checkIfFileExists API.

This commit is contained in:
Xavier Trochu 2015-11-25 15:40:35 +01:00
parent 3b6270236c
commit 81a7203315

View file

@ -80,6 +80,7 @@ module.exports =
logger.log bucketName:bucketName, key:key, "check file existence in s3" logger.log bucketName:bucketName, key:key, "check file existence in s3"
s3.headObject {Bucket: bucketName, Key: key}, (err, data) -> s3.headObject {Bucket: bucketName, Key: key}, (err, data) ->
if err? if err?
return (callback null, false) if err.code == 'NotFound'
logger.err err:err, bucketName:bucketName, key:key, "something went wrong checking head in s3" logger.err err:err, bucketName:bucketName, key:key, "something went wrong checking head in s3"
return callback err return callback err
callback null, data.ETag? callback null, data.ETag?