Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-44637: Fix DBQuote mail header refold#29881

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Julien00859 wants to merge2 commits intopython:main
base:main
Choose a base branch
Loading
fromJulien00859:fix-issue-44637

Conversation

Julien00859
Copy link

@Julien00859Julien00859 commentedDec 1, 2021
edited by bedevere-bot
Loading

When a header content is too long, the RFC demands to fold it over
multiple lines. Each line starting with a space to denote folded-lines
from regular ones.

Folding a line requires splitint it, there are only a few sweet spots
where it is possible to do so (e.g. between two words). Words are pretty
deep in the parse-tree thus multiple parts must be unwrap to reveal
them. One of those parts can be a quoted-string, printing a
quoted-string as a whole correctly wraps its content with double-quotes
but printing every child never quotes them.

When a quoted-string must be unwrap to find a sweet-splot to split the
line, we now inject double-quotes literals before and after its
children.

https://bugs.python.org/issue44637

thehesiod reacted with thumbs up emoji
When a header content is too long, the RFC demands to fold it overmultiple lines. Each line starting with a space to denote folded-linesfrom regular ones.Folding a line requires splitint it, there are only a few sweet spotswhere it is possible to do so (e.g. between two words). Words are prettydeep in the parse-tree thus multiple parts must be unwrap to revealthem. One of those parts can be a quoted-string, printing aquoted-string as a whole correctly wraps its content with double-quotesbut printing every child never quotes them.When a quoted-string must be unwrap to find a sweet-splot to split theline, we now inject double-quotes literals before and after itschildren.
@Julien00859
Copy link
Author

The email refolding algorithm was wrongly removing double-quotes, we now make sure they are correctly inserted when a BareQuotedString part is unwrap. I tried several other approaches in ordernot to bloat the_refold_parse_tree more but I couldn't make them to work.

@Julien00859
Copy link
Author

Not sure it deserves a message in the news, you tell me.

@Julien00859
Copy link
Author

I tested the changes by sending myself an email with a forged message. Server is postfix, client is Thunderbird.

image
issue44637-eml.txt
issue44637-py.txt

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the staleStale PR or inactive for long period of time. labelJan 2, 2022
Copy link
Contributor

@MaxwellDupreMaxwellDupre left a comment

Choose a reason for hiding this comment

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

All email test ok apart from
test_utf8_input_no_charset
Looks ok to me.

@arhadthedev
Copy link
Member

@warsaw could you review (and merge if possible) this PR? The fixed problem has a real-world impact (#88803 (comment)):

Because the proposed PR have been staled for over three months and that we continue to get angry emails from our customers complaining about this issue [...]

@AlexWaygood
Copy link
Member

I'm not familiar with theemail module, but if this is a bugfix, a short NEWS entry is probably warranted. You can add one using the web app here:https://blurb-it.herokuapp.com

Julien00859 reacted with thumbs up emoji

Copy link

@gazfarisgazfaris left a comment

Choose a reason for hiding this comment

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

Compiles, without errors

@Julien00859
Copy link
Author

up, it has been over a year, the issue is still affecting us, it has a clear commit message, tests and all checks are successful

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gazfarisgazfarisgazfaris left review comments

@MaxwellDupreMaxwellDupreMaxwellDupre approved these changes

Assignees
No one assigned
Labels
awaiting core reviewstaleStale PR or inactive for long period of time.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

8 participants
@Julien00859@arhadthedev@AlexWaygood@MaxwellDupre@gazfaris@the-knights-who-say-ni@ezio-melotti@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp