fix: drop event handlers that follow a slash and run no inline handlers in the reader and composer

This commit is contained in:
Linus Rath
2026-10-29 02:54:23 +01:00
parent 388f46b5b9
commit f5e997ba92
5 changed files with 383 additions and 72 deletions
+6 -1
View File
@@ -5,7 +5,7 @@ import { useNavigation } from '@react-navigation/native';
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { Image as ImageIcon, ShieldCheck } from './icons';
import type { Email } from '../api/types';
import { extractCidRefs } from '../lib/email-html';
import { extractCidRefs, isUserLinkNavigation } from '../lib/email-html';
import { hasTruncatedDisplayedBody, pickEmailBody, selectRenderableHtml } from '../lib/email-body';
import { buildQuoteCollapseScript } from '../lib/quote-collapse';
import { bodyDocument } from '../lib/email-body-document';
@@ -834,6 +834,11 @@ export default function EmailBodyView({
// any other) navigation would replace the email body with no way
// back, so it is refused; images are reachable via the chips.
if (!url || url === 'about:blank') return true;
// A message opens links only when the user taps one. The page
// runs no script of its own, so nothing else should navigate;
// iOS says how a navigation started, so anything but a tap is
// refused there as well. Android always reports 'other'.
if (!isUserLinkNavigation(request, Platform.OS)) return false;
if (/^mailto:/i.test(url)) {
openMailto(url);
return false;