codimd
codimd copied to clipboard
Error happened when s3's provider is not aws "Unable to connect to instance metadata service"
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:
https://github.com/hackmdio/codimd/blob/a41c4db0c207caf62e9216b32db194aa1cbefea4/lib/imageRouter/s3.js#L51-L57
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
}