diff --git a/src/socket.io/topics/tags.js b/src/socket.io/topics/tags.js index 08f26635bf..117b63c31a 100644 --- a/src/socket.io/topics/tags.js +++ b/src/socket.io/topics/tags.js @@ -32,7 +32,7 @@ module.exports = function (SocketTopics) { const systemTags = (meta.config.systemTags || '').split(','); const isPrivileged = await user.isPrivileged(socket.uid); - return isPrivileged || !systemTags.includes(data.tag); + return isPrivileged || !systemTags.includes(String(data.tag).trim()); }; SocketTopics.autocompleteTags = async function (socket, data) { diff --git a/src/user/index.js b/src/user/index.js index e2c807ed04..9f8330b791 100644 --- a/src/user/index.js +++ b/src/user/index.js @@ -159,6 +159,9 @@ User.getPrivileges = async function (uid) { }; User.isPrivileged = async function (uid) { + if (!(parseInt(uid, 10) > 0)) { + return false; + } const results = await User.getPrivileges(uid); return results ? (results.isAdmin || results.isGlobalModerator || results.isModeratorOfAnyCategory) : false; };