fix sanitizer exception on null string
This commit is contained in:
parent
3ad513358e
commit
30860ab066
3 changed files with 20 additions and 14 deletions
19
server.js
19
server.js
|
@ -106,14 +106,21 @@ socket.on('connection', function(client){
|
|||
|
||||
//santizes text
|
||||
function scrub( text ) {
|
||||
|
||||
//clip the string if it is too long
|
||||
if (text.length > 65535)
|
||||
if (typeof text != "undefined" && text !== null)
|
||||
{
|
||||
text = text.substr(0,65535);
|
||||
}
|
||||
|
||||
return sanitizer.sanitize(text);
|
||||
//clip the string if it is too long
|
||||
if (text.length > 65535)
|
||||
{
|
||||
text = text.substr(0,65535);
|
||||
}
|
||||
|
||||
return sanitizer.sanitize(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue