fix message length crash
This commit is contained in:
parent
9a5b2c9385
commit
c6db7b86e7
@ -57,6 +57,10 @@ module.exports = {
|
||||
|
||||
req.body.message = encodeURIComponent(req.body.message.trim())
|
||||
|
||||
if(req.body.message.length > 1000) {
|
||||
res.json({"error":"message too long"}) //check again after URI encoding it
|
||||
return
|
||||
}
|
||||
|
||||
req.body.receiver = encodeURIComponent(req.body.receiver||"")
|
||||
if(req.body.receiver == "" || req.body.receiver == encodeURIComponent(res.locals.username) || req.body.receiver.length > 100) {
|
||||
|
@ -54,6 +54,12 @@ module.exports = {
|
||||
}
|
||||
|
||||
req.body.message = encodeURIComponent(req.body.message.trim())
|
||||
|
||||
if(req.body.message.length > 1000) {
|
||||
res.json({"error":"message too long"}) //check again after URI encoding it
|
||||
return
|
||||
}
|
||||
|
||||
req.body.receiver = encodeURIComponent(req.body.receiver||"")
|
||||
if(req.body.receiver == "")req.body.receiver="everyone"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user