Skip to content

Zodix modifying FormData objects #31

@elico5

Description

@elico5

Thanks for the library! Is there a reason Zodix modifies incoming FormData objects (https://github.com/rileytomasek/zodix/blob/master/src/parsers.ts#L189)? We just found a regression in our app related to this behavior as it pertains to FormData with file uploads.

We have a Remix action function that handles incoming FormData differently depending on the FormData's subaction, and one of these handlers expects a File to be present in FormData. We initially use Zodix to parse the subaction via a call to parseFormSafe. Once we know the subaction we pass the FormData towards further Zod validation (variable schema depending on the subaction). Before parsing through Zodix formData.get('file') yields a File object (expected by our downstream validation schema), and then after it yields a string (ex. '{"_name":"file.json","_lastModified":1674149960469}') which causes the downstream schema to fail.

We're giving Zodix a request clone as a workaround, but wanted to toss this behavior on the radar as we would like to unwind it eventually if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions