Skip to content

Make UploadFile check for future rollover #2962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix Coverage Lines
Signed-off-by: Michael Honaker <mchonaker@gmail.com>
  • Loading branch information
HonakerM committed Jul 10, 2025
commit e3cffca44d27451e9b5be7e19bdf1277450ad940
6 changes: 2 additions & 4 deletions starlette/datastructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,8 @@ def _will_roll(self, size_to_add: int) -> bool:

# Check for SpooledTemporaryFile._max_size
max_size = getattr(self.file, "_max_size", None)
if max_size is None:
return False

return bool((self.file.tell() + size_to_add) > max_size)
future_size = self.file.tell() + size_to_add
return bool(future_size > max_size) if max_size is not None else False

async def write(self, data: bytes) -> None:
new_data_len = len(data)
Expand Down