sanitizeQuery fix, minor chat crash fix

This commit is contained in:
mrfry 2022-03-22 18:49:39 +01:00
parent 0a40e1024b
commit 6335069b60
3 changed files with 9 additions and 3 deletions

View file

@ -113,6 +113,9 @@ function setup(data: SubmoduleData): void {
socket.on('chat message', (message) => {
const { reciever, msg, type } = message
if (!reciever || !msg || !type) {
return
}
const recieverUser = dbtools.Select(userDB, 'users', {
id: reciever,
})[0]

View file

@ -22,8 +22,11 @@ import utils from '../utils/utils'
const debugLog = process.env.NS_SQL_DEBUG_LOG
function sanitizeQuery(val: string): string {
return val.replace(/'/g, '').replace(/;/g, '')
function sanitizeQuery(val) {
if (typeof val === 'string') {
return val.replace(/'/g, '').replace(/;/g, '')
}
return val
}
// { asd: 'asd', basd: 4 } => asd = 'asd', basd = 4