diff options
Diffstat (limited to 'controllers')
| -rw-r--r-- | controllers/uploadController.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/controllers/uploadController.js b/controllers/uploadController.js index 3d41116..e819790 100644 --- a/controllers/uploadController.js +++ b/controllers/uploadController.js @@ -77,7 +77,14 @@ uploadsController.upload = function(req, res, next){ stream.on('end', function () { let fileHash = hash.digest('hex') // 34f7a3113803f8ed3b8fd7ce5656ebec - db.table('files').where({ + db.table('files') + .where(function(){ + if(userid === undefined) + this.whereNull('userid') + else + this.where('userid', userid) + }) + .where({ hash: fileHash, size: file.size }).then((dbfile) => { |