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 committed by Sheogorath
parent ee725dc58c
commit 022c7ad616
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD

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 = [80, 443].includes(config.minio.port)
let urlPort = hidePort ? '' : `:${config.minio.port}`
callback(null, `${protocol}://${config.minio.endPoint}${urlPort}/${config.s3bucket}/${key}`)
})
})
}