mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-08-22 02:53:38 +00:00
check type of field values
This commit is contained in:
parent
cbe88122b9
commit
6757c227a9
1 changed files with 5 additions and 1 deletions
|
@ -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])) {
|
||||
|
|
Loading…
Add table
Reference in a new issue