From bcd5f2f83ced11b9685ae97bb79ed7fa803a5309 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 12 Feb 2017 01:39:27 +0900 Subject: [PATCH] [API] Fix bug --- src/api/endpoints/drive/files/create.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/api/endpoints/drive/files/create.js b/src/api/endpoints/drive/files/create.js index c9de93a9c..9f34a551d 100644 --- a/src/api/endpoints/drive/files/create.js +++ b/src/api/endpoints/drive/files/create.js @@ -22,6 +22,10 @@ import create from '../../../common/add-file-to-drive'; module.exports = (file, params, user) => new Promise(async (res, rej) => { + if (file == null) { + return rej('file is required'); + } + const buffer = fs.readFileSync(file.path); fs.unlink(file.path, (err) => { if (err) console.log(err) });