You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 toFormData
with file uploads.We have a Remix action function that handles incoming
FormData
differently depending on theFormData
's subaction, and one of these handlers expects aFile
to be present inFormData
. We initially use Zodix to parse the subaction via a call toparseFormSafe
. Once we know the subaction we pass theFormData
towards further Zod validation (variable schema depending on the subaction). Before parsing through ZodixformData.get('file')
yields aFile
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.
The text was updated successfully, but these errors were encountered: