When s3's api is not provided by AWS(say, googlecloud, azure), an error would happen. because the endpoint-url is overwrited by the region conditional judgment:
|
let s3Endpoint = 's3.amazonaws.com' |
|
if (config.s3.endpoint) { |
|
s3Endpoint = config.s3.endpoint |
|
} else if (config.s3.region && config.s3.region !== 'us-east-1') { |
|
s3Endpoint = `s3-${config.s3.region}.amazonaws.com` |
|
} |
|
callback(null, `https://${s3Endpoint}/${config.s3bucket}/${params.Key}`) |
my suggest code to fix this bug:
let s3Endpoint = 's3.amazonaws.com'
if (config.s3.region && config.s3.region !== 'us-east-1') {
s3Endpoint = `s3-${config.s3.region}.amazonaws.com`
}
if (config.s3.endpoint) {
s3Endpoint = config.s3.endpoint
}