Merge pull request #833 from ahoka/callback

Fix callback validation
This commit is contained in:
Christoph (Sheogorath) Kern
2018-06-01 14:31:44 +02:00
committed by GitHub
4 changed files with 7 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
const url = require('url')
const config = require('../../config')
const logger = require('../../logger')
exports.uploadImage = function (imagePath, callback) {
if (!imagePath || typeof imagePath !== 'string') {
@@ -10,7 +11,7 @@ exports.uploadImage = function (imagePath, callback) {
}
if (!callback || typeof callback !== 'function') {
callback(new Error('Callback has to be a function'), null)
logger.error('Callback has to be a function')
return
}

View File

@@ -11,7 +11,7 @@ exports.uploadImage = function (imagePath, callback) {
}
if (!callback || typeof callback !== 'function') {
callback(new Error('Callback has to be a function'), null)
logger.error('Callback has to be a function')
return
}

View File

@@ -4,6 +4,7 @@ const path = require('path')
const config = require('../../config')
const {getImageMimeType} = require('../../utils')
const logger = require('../../logger')
const Minio = require('minio')
const minioClient = new Minio.Client({
@@ -21,7 +22,7 @@ exports.uploadImage = function (imagePath, callback) {
}
if (!callback || typeof callback !== 'function') {
callback(new Error('Callback has to be a function'), null)
logger.error('Callback has to be a function')
return
}

View File

@@ -4,6 +4,7 @@ const path = require('path')
const config = require('../../config')
const {getImageMimeType} = require('../../utils')
const logger = require('../../logger')
const AWS = require('aws-sdk')
const awsConfig = new AWS.Config(config.s3)
@@ -16,7 +17,7 @@ exports.uploadImage = function (imagePath, callback) {
}
if (!callback || typeof callback !== 'function') {
callback(new Error('Callback has to be a function'), null)
logger.error('Callback has to be a function')
return
}