Hide port from minio URL for protocol default port

Signed-off-by: Thor77 <thor77@thor77.org>
This commit is contained in:
Thor77 2018-12-11 22:23:57 +01:00
parent 7f0fe6903c
commit e928893cfe
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,9 @@ exports.uploadImage = function (imagePath, callback) {
callback(new Error(err), null)
return
}
callback(null, `${protocol}://${config.minio.endPoint}:${config.minio.port}/${config.s3bucket}/${key}`)
let hidePort = (protocol === 'http' && config.minio.port === 80) || (protocol === 'https' && config.minio.port === 443)
let urlPort = hidePort ? '' : `:${config.minio.port}`
callback(null, `${protocol}://${config.minio.endPoint}${urlPort}/${config.s3bucket}/${key}`)
})
})
}