Open isaacharrisholt opened 1 year ago
Me too I’m having this problem. No problem if I upload files with input type file, with node adapter I’ve correctly setup BODY_SIZE_LIMIT env.
But this is happening to me for every kind of input (input type text too) which have a value with a big length. They simply gets cutted during the submit.
I also tried to encode input value with a different format than base64 and also tried to url encode the values but still not working
Any update on this one?
Same issue here. I solved it by converting the string to a blob on the client and then converting it back on the server for anyone else in future.
For some reason, SvelteKit reports a success (204), but truncates any string FormData to exactly 1MB.
I wouldn't mind so much but it's undocumented, so would be good to throw an error or something I think?
Describe the bug
When using the
use:enhance
directive with a form action, there is significant data loss between the client and the server. In this case, I'm passing base64-encoded PNG image data via a hidden input.The client correctly converts to base64 and reports the correct length for the base64 image data (~1.76MB). When the data is sent to the server, the server reports that the length of the file is much less (~767kB), and the data is truncated.
I noticed this when uploading the base64-encoded data to a storage bucket and redownloading the file - only ~half the image data was transferred.
This issue disappears when the
use:enhance
directive is removed, and the server receives the full image.Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-ezby2t?file=src/routes/+page.svelte
Relevant files are:
routes/+page.svelte
routes/+page.server.js
To see the bug in action, upload the following PNG file (assuming GitHub doesn't compress it), then click the
Submit
button. You should see that the file size reported by the client and server differ. This issue disappears ifuse:enhance
is removed from the form.Note: the use of the store is not strictly necessary, but when I discovered this bug, I was working across multiple pages and using a store to transfer the data, so I've included it in this reproduction.
Logs
System Info
Severity
serious, but I can work around it
Additional Information
No response