fix(plugins): bind a Buffer in the single-array bind form of ctx.db as its bytes

This commit is contained in:
Maurice
2026-11-23 15:53:58 +01:00
parent 907fc95b00
commit 4b6911b51f
2 changed files with 9 additions and 1 deletions
+2 -1
View File
@@ -55,7 +55,8 @@ function reviveBuffer(v: unknown): unknown {
export function asArgs(v: unknown): unknown[] {
if (v == null) return [];
if (Array.isArray(v)) return v.map(reviveBuffer);
// The single-array bind form, args: [[a, b]], carries its Buffers one level down.
if (Array.isArray(v)) return v.map((a) => (Array.isArray(a) ? a.map(reviveBuffer) : reviveBuffer(a)));
throw new BadParams('args must be an array');
}