mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: xml-not-well-formed on +255 size lists (#1762)
This commit is contained in:
@@ -22,6 +22,9 @@ export const encodeBinaryNode = (
|
|||||||
const pushBytes = (bytes: Uint8Array | Buffer | number[]) => (
|
const pushBytes = (bytes: Uint8Array | Buffer | number[]) => (
|
||||||
bytes.forEach (b => buffer.push(b))
|
bytes.forEach (b => buffer.push(b))
|
||||||
)
|
)
|
||||||
|
const pushInt16 = (value: number) => {
|
||||||
|
pushBytes([(value >> 8) & 0xff, value & 0xff])
|
||||||
|
}
|
||||||
const pushInt20 = (value: number) => (
|
const pushInt20 = (value: number) => (
|
||||||
pushBytes([(value >> 16) & 0x0f, (value >> 8) & 0xff, value & 0xff])
|
pushBytes([(value >> 16) & 0x0f, (value >> 8) & 0xff, value & 0xff])
|
||||||
)
|
)
|
||||||
@@ -194,7 +197,8 @@ export const encodeBinaryNode = (
|
|||||||
} else if(listSize < 256) {
|
} else if(listSize < 256) {
|
||||||
pushBytes([TAGS.LIST_8, listSize])
|
pushBytes([TAGS.LIST_8, listSize])
|
||||||
} else {
|
} else {
|
||||||
pushBytes([TAGS.LIST_16, listSize])
|
pushByte(TAGS.LIST_16)
|
||||||
|
pushInt16(listSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user