Open
Description
Version: Deno 1.45.5
Given the following HTML:
<form method=post enctype="multipart/form-data">
<input type=file name=files multiple>
<input type=submit>
</form>
Assuming no files are selected, calling FormData#get('files')
on a FormData
object constructed from this form on the client side (tested latest Chrome, FireFox) gives an empty File
object. However, calling (await req.formData()).get('files')
on the Request
given by Deno.serve
gives an empty string ""
instead.
Notably, FormData#getAll('files')
gives an array of length 1 in both Deno and browsers, which hopefully everyone can agree is a horrible way of representing zero files, but the content of that array's element differs (again, it's an empty file on client side vs an empty string on Deno).
Repro: https://dash.deno.com/projects/formdata-no-files-repro
Activity
lionel-rowe commentedon Aug 11, 2024
Observed browser behavior looks to be correct per the spec:
Meanwhile, the raw HTTP request body looks something like this: