Skip to content

Commit 3b8f4bc

Browse files
authored
Merge pull request #486 from kota-row/fix_s3_url
fix s3 us-east-1 region endpoint
2 parents c8d3951 + 1220bbe commit 3b8f4bc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/web/imageRouter.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ imageRouter.post('/uploadimage', function (req, res) {
6464
res.status(500).end('upload image error')
6565
return
6666
}
67+
68+
var s3Endpoint = 's3.amazonaws.com'
69+
if (config.s3.region && config.s3.region !== 'us-east-1') { s3Endpoint = `s3-${config.s3.region}.amazonaws.com` }
6770
res.send({
68-
link: `https://s3-${config.s3.region}.amazonaws.com/${config.s3bucket}/${params.Key}`
71+
link: `https://${s3Endpoint}/${config.s3bucket}/${params.Key}`
6972
})
7073
})
7174
})

0 commit comments

Comments
 (0)