summaryrefslogtreecommitdiff
path: root/packages/backend/src/server
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-05-06 18:48:22 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-05-08 11:23:20 -0400
commit6757c227a9509f9b92a9e7a0e9f606a89f3e9727 (patch)
treee511e71e5b3b30c0ea98b4f53c0e75526031051f /packages/backend/src/server
parentfix hook targets (diff)
downloadsharkey-6757c227a9509f9b92a9e7a0e9f606a89f3e9727.tar.gz
sharkey-6757c227a9509f9b92a9e7a0e9f606a89f3e9727.tar.bz2
sharkey-6757c227a9509f9b92a9e7a0e9f606a89f3e9727.zip
check type of field values
Diffstat (limited to 'packages/backend/src/server')
-rw-r--r--packages/backend/src/server/ServerUtilityService.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/backend/src/server/ServerUtilityService.ts b/packages/backend/src/server/ServerUtilityService.ts
index 115717534f..8cecc5df58 100644
--- a/packages/backend/src/server/ServerUtilityService.ts
+++ b/packages/backend/src/server/ServerUtilityService.ts
@@ -37,9 +37,13 @@ export class ServerUtilityService {
for await (const part of request.parts()) {
if (part.type === 'field') {
const k = part.fieldname;
- const v = String(part.value);
+ const v = part.value;
const body = request.body ??= {};
+ // Value can be string, buffer, or undefined.
+ // We only support the first one.
+ if (typeof(v) !== 'string') continue;
+
// This is just progressive conversion from undefined -> string -> string[]
if (body[k]) {
if (Array.isArray(body[k])) {