Skip to content

Commit

Permalink
Rename max_file_size to spool_max_size
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Dec 3, 2024
1 parent db5063c commit 58e20cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions starlette/formparsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ async def parse(self) -> FormData:


class MultiPartParser:
max_file_size = 1024 * 1024 # 1MB
spool_max_size = 1024 * 1024 # 1MB
"""The maximum size of the spooled temporary file used to store file data."""
max_part_size = 1024 * 1024 # 1MB
"""The maximum size of a part in the multipart request."""

def __init__(
self,
Expand Down Expand Up @@ -201,7 +203,7 @@ def on_headers_finished(self) -> None:
if self._current_files > self.max_files:
raise MultiPartException(f"Too many files. Maximum number of files is {self.max_files}.")
filename = _user_safe_decode(options[b"filename"], self._charset)
tempfile = SpooledTemporaryFile(max_size=self.max_file_size)
tempfile = SpooledTemporaryFile(max_size=self.spool_max_size)
self._files_to_close_on_error.append(tempfile)
self._current_part.file = UploadFile(
file=tempfile, # type: ignore[arg-type]
Expand Down

0 comments on commit 58e20cc

Please sign in to comment.