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
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) => {