mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
prevent crash if data.enter is not string
This commit is contained in:
@@ -92,7 +92,7 @@ app.cacheBuster = null;
|
|||||||
|
|
||||||
switch(url_parts[0]) {
|
switch(url_parts[0]) {
|
||||||
case 'user':
|
case 'user':
|
||||||
room = 'user/' + ajaxify.data ? ajaxify.data.theirid : 0;
|
room = 'user/' + (ajaxify.data ? ajaxify.data.theirid : 0);
|
||||||
break;
|
break;
|
||||||
case 'topic':
|
case 'topic':
|
||||||
room = 'topic_' + url_parts[1];
|
room = 'topic_' + url_parts[1];
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ SocketMeta.rooms.enter = function(socket, data, callback) {
|
|||||||
return callback(new Error('[[error:invalid-data]]'));
|
return callback(new Error('[[error:invalid-data]]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.enter) {
|
||||||
|
data.enter = data.enter.toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (data.enter && data.enter.startsWith('uid_') && data.enter !== 'uid_' + socket.uid) {
|
if (data.enter && data.enter.startsWith('uid_') && data.enter !== 'uid_' + socket.uid) {
|
||||||
return callback(new Error('[[error:not-allowed]]'));
|
return callback(new Error('[[error:not-allowed]]'));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user