When a received email contains an inline attachment with a CID but no
matching img[src="cid:..."] in the HTML body, tmail previously hid it
completely — not shown in the body (no img tag) and not in the attachment
panel (isOutsideAttachment returned false due to hasCid+isDispositionInlined).
In GetEmailContentInteractor, extract referenced CIDs from the raw HTML
before transformation, then split allInlineImages into referenced (rendered
in body) and orphaned (no body reference). Orphaned attachments are promoted
to the attachment panel so users can see and download them.
In replaceImageBase64ToImageCID, the early-return path blindly returned
all inline attachments even when none were referenced by a cid: img tag
in the HTML body. This caused orphaned inline blobs (CID present in JMAP
metadata but no body reference) to be silently re-attached on every
reply/forward, propagating malformed MIME structure across the thread.
Fix 1: early-return now checks for actual img[src^="cid:"] body references
before including any attachment — orphaned entries are dropped.
Fix 2: after the base64 loop, scan remaining cid: img tags and include
their attachments so images that failed to download are still forwarded.
- handlerKey: verify two instances of same class with distinct keys coexist,
same key replaces existing handler, both handlers receive dispatched records
- fault-isolation: verify handles()/handle() throwing does not crash dispatch
and remaining handlers still receive the record
- critical level: verify Level.critical maps to SentryLevel.fatal in both
captureException and captureMessage paths of SentryEventHandler
- Wrap each handler.handle() in try/catch so a failing handler does not
abort the remaining handlers or bubble exceptions to callers
- Fix _FakeSentryReporter.addBreadcrumb signature to match SentryReporter
interface (add level and category named parameters)
- addBreadcrumb gains level (default SentryLevel.debug) and category
params in SentryReporter interface and SentryManager implementation;
SentryBreadcrumbHandler passes level: SentryLevel.debug, category: 'log'
so breadcrumbs on error events are clearly labelled in Sentry UI
- captureMessage param order aligned to {extras, level} in SentryManager
to match the SentryReporter interface declaration
- Test: _FakeSentryReporter updated; new test case asserts level/category
webConsoleEnabled was deprecated in favour of a global constructor flag,
but that removed the ability to force specific log calls visible on web
in release/profile mode — a legitimate need for auth and Sentry init
diagnostics.
Carry webConsoleEnabled through the full pipeline:
LogRecord → buildLogRecord → _dispatch → public log functions.
ConsoleLogHandler reads the flag from the record rather than from its
constructor, so per-call opt-in works independently of build mode.
On web:
- handles() always returns true (filter deferred to handle())
- handle() prints only when record.webConsoleEnabled || isDebugMode
Existing call sites (authorization_interceptors, sentry_config) that
pass webConsoleEnabled: true are preserved and functional again.
- app_logger_registry: add _OtherFakeHandler subclass; fix
'dispatches to multiple handlers' to register two distinct types
and assert both receive the record; use const LogRecord
- sentry_breadcrumb_handler: track capturedExceptions/capturedMessages
in fake; assert both are empty in 'does not call' test
- sentry_event_handler: add SentryLevel to fake captured records;
assert mapped severity in captureException/captureMessage tests
Before sending input to the LLM, we clean the composer input to
remove html tags. We relied on regex that we not complete enough and
could be bypassed easily. So let's use the html parser available in
Dart instead.
I also added some tests.