Skip to content

connector-gmail: detect Outlook reply header as quoted content#132

Merged
KrisBraun merged 1 commit into
mainfrom
fix/gmail-strip-outlook-quoted-replies
Apr 30, 2026
Merged

connector-gmail: detect Outlook reply header as quoted content#132
KrisBraun merged 1 commit into
mainfrom
fix/gmail-strip-outlook-quoted-replies

Conversation

@KrisBraun

Copy link
Copy Markdown
Contributor

Summary

  • The HTML quote-stripping only matched Gmail's gmail_quote class and Outlook web's appendonsend/divRplyFwdMsg ids. Microsoft Outlook desktop and corporate Exchange clients (e.g. Gowlings) wrap replies with a bolded From: / Sent: / To: / Subject: header block inside a <div style="border-top:..."> divider (or <hr>), so the whole prior thread got re-ingested into every note.
  • Detect the bolded four-header sequence in close proximity, then walk back up to 1000 chars to cut at the nearest <hr> or border-top <div>; if neither is present, cut at the start of the wrapping <p>/<div>. Requiring all four headers (not three) keeps ordinary prose from triggering the matcher.

Test plan

  • Sanity-checked against synthetic samples covering: Outlook desktop (border-top div), OWA (hr divider), no-divider, <strong> instead of <b>, no-quote (unchanged), and gmail_quote precedence — all pass.
  • pnpm build clean in connectors/gmail.
  • After deploy, verify a fresh Gowlings reply in the original thread comes in with quoted content stripped.

🤖 Generated with Claude Code

The existing HTML quote-stripping only matched Gmail's `gmail_quote`
class and Outlook web's `appendonsend`/`divRplyFwdMsg` ids. Microsoft
Outlook desktop and corporate Exchange clients (e.g. Gowlings) wrap
replies with a bolded `From:`/`Sent:`/`To:`/`Subject:` header block
inside a `<div style="border-top:...">` divider (or `<hr>`), which fell
through to no-op stripping and meant the entire prior thread got
re-ingested into every note.

Detect the bolded four-header sequence in close proximity, then walk
back up to 1000 chars to cut at the nearest `<hr>` or border-top
`<div>`; if neither is present, cut at the start of the wrapping
`<p>`/`<div>`. Requiring all four headers (not three) keeps ordinary
prose from triggering the matcher.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@KrisBraun KrisBraun merged commit e5a9e61 into main Apr 30, 2026
1 check passed
@KrisBraun KrisBraun deleted the fix/gmail-strip-outlook-quoted-replies branch April 30, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant