fix(Webhook Node): Backward compatible form-data parsing for non-array fields (#6967)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-08-18 12:34:42 +02:00
committed by GitHub
parent 41db6371f0
commit 9455bcfef5
3 changed files with 12 additions and 5 deletions

View File

@@ -309,6 +309,11 @@ export async function executeWebhook(
});
req.body = await new Promise((resolve) => {
form.parse(req, async (err, data, files) => {
for (const key in data) {
if (Array.isArray(data[key]) && data[key].length === 1) {
data[key] = data[key][0];
}
}
resolve({ data, files });
});
});