From 1220bbe9f6889d65aec6b881f8bac3a7b400ed79 Mon Sep 17 00:00:00 2001 From: Kotaro Yamamoto Date: Wed, 14 Jun 2017 10:08:43 +0900 Subject: fix s3 us-east-1 region endpoint --- lib/web/imageRouter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/web/imageRouter.js b/lib/web/imageRouter.js index 592a497c..bebab302 100644 --- a/lib/web/imageRouter.js +++ b/lib/web/imageRouter.js @@ -64,8 +64,11 @@ imageRouter.post('/uploadimage', function (req, res) { res.status(500).end('upload image error') return } + + var s3Endpoint = 's3.amazonaws.com' + if (config.s3.region && config.s3.region !== 'us-east-1') { s3Endpoint = `s3-${config.s3.region}.amazonaws.com` } res.send({ - link: `https://s3-${config.s3.region}.amazonaws.com/${config.s3bucket}/${params.Key}` + link: `https://${s3Endpoint}/${config.s3bucket}/${params.Key}` }) }) }) -- cgit v1.2.3