fix: allow posting empty key files in multipart/form-data (#2664)

This commit is contained in:
Damanpreet Singh 2022-10-07 02:29:15 +05:30 committed by GitHub
parent fcd61436c8
commit c35a85db12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -250,7 +250,7 @@ watch(
workingParams.value,
A.filterMap(
flow(
O.fromPredicate((e) => e.entry.key !== ""),
O.fromPredicate((e) => e.entry.key !== "" || e.entry.isFile),
O.map((e) => e.entry)
)
)
@ -271,7 +271,7 @@ watch(workingParams, (newWorkingParams) => {
newWorkingParams,
A.filterMap(
flow(
O.fromPredicate((e) => e.entry.key !== ""),
O.fromPredicate((e) => e.entry.key !== "" || e.entry.isFile),
O.map((e) => e.entry)
)
)

View file

@ -254,7 +254,7 @@ function getFinalBodyFromRequest(
if (request.body.contentType === "multipart/form-data") {
return pipe(
request.body.body,
A.filter((x) => x.key !== "" && x.active), // Remove empty keys
A.filter((x) => (x.key !== "" || x.isFile) && x.active), // Remove empty keys
// Sort files down
arraySort((a, b) => {