mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: incorrect enc msg detection
This commit is contained in:
@@ -30,7 +30,9 @@ export const decodeWAMessage = (
|
|||||||
if(typeof data === 'string' || !possiblyEnc) {
|
if(typeof data === 'string' || !possiblyEnc) {
|
||||||
json = JSON.parse(data.toString()) // parse the JSON
|
json = JSON.parse(data.toString()) // parse the JSON
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
|
json = JSON.parse(data.toString())
|
||||||
|
} catch {
|
||||||
const { macKey, encKey } = auth || {}
|
const { macKey, encKey } = auth || {}
|
||||||
if (!macKey || !encKey) {
|
if (!macKey || !encKey) {
|
||||||
throw new Boom('recieved encrypted buffer when auth creds unavailable', { data: message, statusCode: DisconnectReason.badSession })
|
throw new Boom('recieved encrypted buffer when auth creds unavailable', { data: message, statusCode: DisconnectReason.badSession })
|
||||||
@@ -66,6 +68,7 @@ export const decodeWAMessage = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return [messageTag, json, tags] as const
|
return [messageTag, json, tags] as const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user