From 05a0110dc9b53de28e7e45e33f5df6251ec2def6 Mon Sep 17 00:00:00 2001 From: mgarbacz Date: Thu, 7 Aug 2014 17:54:54 -0500 Subject: [PATCH] Non-existant file just comes back empty from S3, handle it --- s3.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/s3.js b/s3.js index d280371..5cfad07 100644 --- a/s3.js +++ b/s3.js @@ -13,6 +13,7 @@ exports.getFile = function(fileName, callback) { var s3 = new aws.S3(); var data = { Key: fileName, Bucket: 'wotf-cyoa' }; s3.getObject(data, function(err, data) { - callback(err, data.Body); + if (data === null) callback (true, false); + else callback(err, data.Body); }); };