From aadea856c339c90d2d5751e8c6d6c9f507e5745d Mon Sep 17 00:00:00 2001 From: Roman Shtylman Date: Fri, 19 Oct 2018 12:28:05 -0700 Subject: [PATCH] server: fix content-length-range s3 uplaod policy The max size should be an integer rather than a string (environment variables are strings). More strict s3 implementations reject the upload because they do not consider the policy valid if a string is used rather than an integer. --- server/utils/s3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils/s3.js b/server/utils/s3.js index ffe4867c..1e423390 100644 --- a/server/utils/s3.js +++ b/server/utils/s3.js @@ -17,7 +17,7 @@ export const makePolicy = () => { { bucket: process.env.AWS_S3_UPLOAD_BUCKET_NAME }, ['starts-with', '$key', ''], { acl: 'public-read' }, - ['content-length-range', 0, process.env.AWS_S3_UPLOAD_MAX_SIZE], + ['content-length-range', 0, +process.env.AWS_S3_UPLOAD_MAX_SIZE], ['starts-with', '$Content-Type', 'image'], ['starts-with', '$Cache-Control', ''], ],