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.
This commit is contained in:
Roman Shtylman
2018-10-19 12:28:05 -07:00
parent 61cce88ef8
commit aadea856c3

View File

@ -17,7 +17,7 @@ export const makePolicy = () => {
{ bucket: process.env.AWS_S3_UPLOAD_BUCKET_NAME }, { bucket: process.env.AWS_S3_UPLOAD_BUCKET_NAME },
['starts-with', '$key', ''], ['starts-with', '$key', ''],
{ acl: 'public-read' }, { 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', '$Content-Type', 'image'],
['starts-with', '$Cache-Control', ''], ['starts-with', '$Cache-Control', ''],
], ],