Skip to content

Commit 4ae3213

Browse files
authored
Rename max_file_size to spool_max_size (#2780)
1 parent 4e1c3c2 commit 4ae3213

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

starlette/formparsers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ async def parse(self) -> FormData:
122122

123123

124124
class MultiPartParser:
125-
max_file_size = 1024 * 1024 # 1MB
125+
spool_max_size = 1024 * 1024 # 1MB
126+
"""The maximum size of the spooled temporary file used to store file data."""
127+
max_part_size = 1024 * 1024 # 1MB
128+
"""The maximum size of a part in the multipart request."""
126129

127130
def __init__(
128131
self,
@@ -202,7 +205,7 @@ def on_headers_finished(self) -> None:
202205
if self._current_files > self.max_files:
203206
raise MultiPartException(f"Too many files. Maximum number of files is {self.max_files}.")
204207
filename = _user_safe_decode(options[b"filename"], self._charset)
205-
tempfile = SpooledTemporaryFile(max_size=self.max_file_size)
208+
tempfile = SpooledTemporaryFile(max_size=self.spool_max_size)
206209
self._files_to_close_on_error.append(tempfile)
207210
self._current_part.file = UploadFile(
208211
file=tempfile, # type: ignore[arg-type]

0 commit comments

Comments
 (0)