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

@ -1 +1 @@
Subproject commit 1012880e899ad328f7a637a6d1512dab7afd24d5
Subproject commit 4f82b9d8c9c32ebbd9d73b951fc1db26ad1ceb22