Skip to content

Commit

Permalink
use bytearray
Browse files Browse the repository at this point in the history
  • Loading branch information
provinzkraut committed Nov 24, 2024
1 parent 44895e0 commit 5373343
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions litestar/_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async def parse_multipart_form( # noqa: C901
try:
with PushMultipartParser(boundary, max_segment_count=multipart_form_part_limit) as parser:
segment: MultipartSegment | None = None
data: UploadFile | bytes = b""
data: UploadFile | bytearray = bytearray()
while not parser.closed:
for form_part in parser.parse(chunk):
if isinstance(form_part, MultipartSegment):
Expand All @@ -90,7 +90,7 @@ async def parse_multipart_form( # noqa: C901
if isinstance(data, UploadFile):
await data.write(form_part)
else:
data += form_part
data.extend(form_part)
else:
# end of part
if segment is None:
Expand All @@ -107,7 +107,7 @@ async def parse_multipart_form( # noqa: C901
fields[segment.name].append(None)

# reset for next part
data = b""
data = bytearray()
segment = None

chunk = await async_next(stream, b"")
Expand Down

0 comments on commit 5373343

Please sign in to comment.