Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
fix fieldMimeTypes fiber ref (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored Nov 13, 2023
1 parent bbd5718 commit 2bbe692
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/fresh-shirts-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@effect/platform-node": patch
"@effect/platform": patch
---

fix fieldMimeTypes fiber ref
6 changes: 2 additions & 4 deletions packages/platform-node/src/internal/http/formData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,10 @@ class FileImpl implements FormData.File {
readonly contentType: string
readonly content: Stream.Stream<never, FormData.FormDataError, Uint8Array>

constructor(
readonly file: MP.FileStream
) {
constructor(readonly file: MP.FileStream) {
this[FormData.TypeId] = FormData.TypeId
this.key = file.info.name
this.name = file.filename
this.name = file.filename ?? file.info.name
this.contentType = file.info.contentType
this.content = NodeStream.fromReadable(() => file, (error) => FormData.FormDataError("InternalError", error))
}
Expand Down
5 changes: 4 additions & 1 deletion packages/platform/src/internal/http/formData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ export const makeConfig = (
return undefined
}
return (info: MP.PartInfo): boolean =>
Chunk.some(mimeTypes, (_) => info.contentType.includes(_)) || MP.defaultIsFile(info)
!Chunk.some(
mimeTypes,
(_) => info.contentType.includes(_)
) && MP.defaultIsFile(info)
})
}),
(_) => ({ ..._, headers })
Expand Down

0 comments on commit 2bbe692

Please sign in to comment.