fix message length crash
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user