fix: attachment reminder ignores quoted text on reply/forward #570

This commit is contained in:
Linus Rath
2026-07-07 23:54:50 +02:00
parent 6470fa86f0
commit c7d551f185
3 changed files with 136 additions and 1 deletions
+8 -1
View File
@@ -46,6 +46,7 @@ import {
formatRecipientList,
splitPastedRecipients,
waitForPendingUploads,
extractUserAuthoredText,
type Recipient,
} from "@/lib/email-composer-utils";
import { isValidEmail } from "@/lib/validation";
@@ -1599,7 +1600,13 @@ export function EmailComposer({
if (!skipAttachmentCheck && attachmentReminderEnabled) {
const hasAttachments = attachmentsRef.current.some(att => att.blobId && !att.uploading && !att.error);
if (!hasAttachments) {
const bodyText = htmlToPlainText(body);
// Scan only the user-authored text: the quoted original of a
// reply/forward often mentions an attachment itself, which used to fire
// the reminder even when the user typed no keyword and added nothing (#570).
const bodyText = extractUserAuthoredText(body, {
plainTextMode,
forwardedSeparator: tQuote('forwarded_separator'),
});
const searchText = `${subject} ${bodyText}`.toLowerCase();
const matched = attachmentReminderKeywords.find(kw => searchText.includes(kw.toLowerCase()));
if (matched) {