From d61394b041a2677ad7b2e617ab175551816b0bc1 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Tue, 27 Oct 2015 22:09:49 -0700 Subject: [PATCH] Generate correct date for AMZ credentials. The old function was adding numbers together instead of strings. Convert the numbers to strings before addition. --- infrastructure/framework-src/modules/s3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infrastructure/framework-src/modules/s3.js b/infrastructure/framework-src/modules/s3.js index 55be936..ca5852d 100644 --- a/infrastructure/framework-src/modules/s3.js +++ b/infrastructure/framework-src/modules/s3.js @@ -122,8 +122,8 @@ function getS3PolicyAndSig(domain, localPadId, userId) { var expirationDate = new Date(); expirationDate.setDate(expirationDate.getDate() + 1); - function pad(n) { return n < 10 ? '0' + n : n } - var utcDateStr = expirationDate.getUTCFullYear() + + function pad(n) { return n < 10 ? '0' + n.toString() : n.toString() } + var utcDateStr = pad(expirationDate.getUTCFullYear()) + pad(expirationDate.getUTCMonth() + 1) + pad(expirationDate.getUTCDate());