瀏覽代碼

Fixed bug that caused people to upload as anon even if running private

Pitu 7 年之前
父節點
當前提交
14cf45c168
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      controllers/uploadController.js

+ 7 - 1
controllers/uploadController.js

@@ -42,8 +42,14 @@ uploadsController.upload = function(req, res, next) {
 	if (token === undefined) token = ''
 
 	db.table('users').where('token', token).then((user) => {
+
+		if(user.length === 0)
+			if(config.private === true)
+				return res.status(401).json({ success: false, description: 'Invalid token provided' })
+
 		let userid
-		if (user.length > 0) userid = user[0].id
+		if(user.length > 0)
+			userid = user[0].id
 
 		// Check if user is trying to upload to an album
 		let album