Skip to content

Commit 3ab0b7e

Browse files
authored
Merge pull request #1762 from blademainer/develop
fixes #1761
2 parents a7564e7 + 7b1e4e3 commit 3ab0b7e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/imageRouter/s3.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ exports.uploadImage = function (imagePath, callback) {
4848
const command = new PutObjectCommand(params)
4949

5050
s3.send(command).then(data => {
51-
let s3Endpoint = 's3.amazonaws.com'
51+
// default scheme settings to https
52+
let s3Endpoint = 'https://s3.amazonaws.com'
53+
if (config.s3.region && config.s3.region !== 'us-east-1') {
54+
s3Endpoint = `s3-${config.s3.region}.amazonaws.com`
55+
}
56+
// rewrite endpoint from config
5257
if (config.s3.endpoint) {
5358
s3Endpoint = config.s3.endpoint
54-
} else if (config.s3.region && config.s3.region !== 'us-east-1') {
55-
s3Endpoint = `s3-${config.s3.region}.amazonaws.com`
5659
}
57-
callback(null, `https://${s3Endpoint}/${config.s3bucket}/${params.Key}`)
60+
callback(null, `${s3Endpoint}/${config.s3bucket}/${params.Key}`)
5861
}).catch(err => {
5962
if (err) {
6063
callback(new Error(err), null)

0 commit comments

Comments
 (0)