* Filter out Uint8Array arguments in data.args and convert them to a Buffer using b4a library if needed.

This commit is contained in:
Derrick Hammer 2023-04-09 00:16:31 -04:00
parent a53c238889
commit 473f678a45
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 12 additions and 2 deletions

View File

@ -216,8 +216,18 @@ class Message extends Client {
},
},
async (data: any) => {
if (data?.args && data?.args[0] instanceof Uint8Array) {
data.args[0] = b4a.from(data.args[0]);
if (data.args) {
data.args = data.args.filter((arg: any) => {
if (arg instanceof Uint8Array) {
return b4a.from(arg);
}
return arg;
});
}
if (data?.args && data?.args[0]?.buffer instanceof Uint8Array) {
data.args[0].buffer = b4a.from(data.args[0].buffer);
}
switch (data.action) {
case "encode":