summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMax Wu2017-06-14 11:59:14 +0800
committerGitHub2017-06-14 11:59:14 +0800
commit3b8f4bc1a256733361e29be16a48e39d41f7c420 (patch)
tree6599147cefb77d74950e2eb2e2fb5b6830a67702 /lib
parentc8d3951d321a4191f75a4589c33630c847098b57 (diff)
parent1220bbe9f6889d65aec6b881f8bac3a7b400ed79 (diff)
Merge pull request #486 from kota-row/fix_s3_url
fix s3 us-east-1 region endpoint
Diffstat (limited to 'lib')
-rw-r--r--lib/web/imageRouter.js5
1 files changed, 4 insertions, 1 deletions
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}`
})
})
})