refactor: fix lint on lib/web/imageRouter/minio.js

Signed-off-by: BoHong Li <raccoon@hackmd.io>
This commit is contained in:
BoHong Li 2019-08-02 01:00:24 +08:00
parent 0c9195b731
commit c8ffd2ab19
No known key found for this signature in database
GPG Key ID: 06770355DC9ECD38
1 changed files with 4 additions and 4 deletions

View File

@ -32,16 +32,16 @@ exports.uploadImage = function (imagePath, callback) {
return
}
let key = path.join('uploads', path.basename(imagePath))
let protocol = config.minio.secure ? 'https' : 'http'
const key = path.join('uploads', path.basename(imagePath))
const protocol = config.minio.secure ? 'https' : 'http'
minioClient.putObject(config.s3bucket, key, buffer, buffer.size, getImageMimeType(imagePath), function (err, data) {
if (err) {
callback(new Error(err), null)
return
}
let hidePort = [80, 443].includes(config.minio.port)
let urlPort = hidePort ? '' : `:${config.minio.port}`
const hidePort = [80, 443].includes(config.minio.port)
const urlPort = hidePort ? '' : `:${config.minio.port}`
callback(null, `${protocol}://${config.minio.endPoint}${urlPort}/${config.s3bucket}/${key}`)
})
})