File tree Expand file tree Collapse file tree
services/apps/mailing_list_integration/src/crowdmail/services/parse Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -303,16 +303,19 @@ def parse_email(
303303 seen_content = False
304304 # Skip quoted lines ">" and empty ones when counting lines of new content
305305 for line in iter (body .splitlines ()):
306- if not seen_content and len (line ) != 0 :
307- # Only the very first non-empty line of the body may override
308- # authorship (this is where git-format-patch / b4 put it). A
309- # "From: " appearing later in the body is just content (e.g. a
310- # forwarded or pasted message) and must not hijack attribution.
306+ # Only the very first non-empty line of the body may override
307+ # authorship (this is where git-format-patch / b4 put it). A
308+ # "From: " appearing later in the body is just content (e.g. a
309+ # forwarded or pasted message) and must not hijack attribution nor
310+ # be excluded from the stored body/line count.
311+ is_first_content_line = not seen_content and len (line ) != 0
312+ is_from_override = is_first_content_line and line .find ("From: " ) == 0
313+ if is_first_content_line :
311314 seen_content = True
312- if line . find ( "From: " ) == 0 :
315+ if is_from_override :
313316 author_name , author_email = parse_author (line )
314317
315- if line .find (">" ) != 0 and line .find ("On " ) != 0 and line . find ( "From: " ) != 0 :
318+ if line .find (">" ) != 0 and line .find ("On " ) != 0 and not is_from_override :
316319 if len (line ) != 0 :
317320 num_lines += 1
318321 json_body += line
You can’t perform that action at this time.
0 commit comments