Skip to content

Correct parsing up to a potential partial boundary#3081

Merged
davidism merged 1 commit intopallets:stablefrom
pgjones:multipart
Jan 2, 2026
Merged

Correct parsing up to a potential partial boundary#3081
davidism merged 1 commit intopallets:stablefrom
pgjones:multipart

Conversation

@pgjones
Copy link
Copy Markdown
Member

@pgjones pgjones commented Dec 23, 2025

This adjusts b1916c0 by ensuring CR, \r, are not ignored if an earlier LR, \n, is present when considering if a partial boundary can exist. This would result in trailing CR, \r, being added to the data rather than part of a potential partial boundary.

This correctly fixes #3065 and fixes #3077.

@pgjones pgjones mentioned this pull request Dec 23, 2025
@davidism davidism added this to the 3.1.5 milestone Jan 2, 2026
This adjusts b1916c0 by ensuring CR,
\r, are not ignored if an earlier LR, \n, is present when considering
if a partial boundary can exist. This would result in trailing CR, \r,
being added to the data rather than part of a potential partial
boundary.
@davidism davidism changed the base branch from main to stable January 2, 2026 18:56
@davidism davidism merged commit 0f76c35 into pallets:stable Jan 2, 2026
13 checks passed
def _last_partial_boundary_index(self, data: bytes | bytearray) -> int:
# Find the last index following which a partial boundary
# could be present in the data. This will be the earliest
# position of a LR or a CR, unless that position is more
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pgjones @davidism nitpicky, but: I think LR was probably intended to be LF in this comment?

Suggested change
# position of a LR or a CR, unless that position is more
# position of a LF or a CR, unless that position is more

@johan-bjareholt
Copy link
Copy Markdown

johan-bjareholt commented Jan 19, 2026

Is it possible that this change created the following bug? #3088
Seems very related at least.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

4 participants