feat: Optional max_file_size for parsing form files
Summary
Limiting the size of file being uploaded in case the storage is limited or some business logic can't handle certain size.
Checklist
- [x] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
- [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
- [x] I've updated the documentation accordingly.
If we instead make the max_part_size configurable, would that already be good enough here?
If we instead make the
max_part_sizeconfigurable, would that already be good enough here?
But from what I see here is that this is only applied to non file parts.
If we instead make the
max_part_sizeconfigurable, would that already be good enough here?But from what I see here is that this is only applied to non file parts.
Hmmm... Does it make sense to be only on non file parts tho? 🤔
@Kludex I think we need different limits for parts vs files. As files are spooled, we could allow larger size but for parts we want to have a stricter limit as it is stored in memory. I can re-work the PR to make it configurable for both.
@Kludex what do you think about making all of limits configurable? https://github.com/encode/starlette/pull/2798/files I see that you are going to rename the max_file_size here https://github.com/encode/starlette/pull/2780 I can adjust naming if we can go forward with making all of the size limits configurable.
We can make the limits configurable. We just need to adjust the naming, yep.
Let's start by making the spool one configurable, and then we add 1 by one. 🙏
Can you help?