From 746e02af07f7dc223940ad80a0a234c0aff85850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 9 Oct 2022 18:57:43 +0200 Subject: Load external references in encrypted emails only on explicit request. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Taken from KDE patches and adapted to TDE. See https://phabricator.kde.org/D12391 Signed-off-by: Slávek Banko --- kmail/kmreaderwin.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'kmail') diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp index 184167b09..9ecb56b1a 100644 --- a/kmail/kmreaderwin.cpp +++ b/kmail/kmreaderwin.cpp @@ -1408,8 +1408,6 @@ void KMReaderWin::updateReaderWin() { if (!mMsgDisplay) return; - mViewer->setOnlyLocalReferences(!htmlLoadExternal()); - htmlWriter()->reset(); KMFolder* folder = 0; @@ -1579,6 +1577,7 @@ void KMReaderWin::parseMsg(KMMessage* aMsg) // - this can only be done *after* calling parseObjectTree() KMMsgEncryptionState encryptionState = mRootNode->overallEncryptionState(); KMMsgSignatureState signatureState = mRootNode->overallSignatureState(); + mViewer->setOnlyLocalReferences(!htmlLoadExternal()); // Don't crash when switching message while GPG passphrase entry dialog is shown #53185 if (aMsg != message()) { displayMessage(); @@ -2515,8 +2514,19 @@ bool KMReaderWin::htmlMail() //----------------------------------------------------------------------------- bool KMReaderWin::htmlLoadExternal() { - return ((mHtmlLoadExternal && !mHtmlLoadExtOverride) || - (!mHtmlLoadExternal && mHtmlLoadExtOverride)); + if (!mRootNode) + { + return mHtmlLoadExtOverride; + } + + // when displaying an encrypted message, only load external resources on explicit request + if (mRootNode->overallEncryptionState() != KMMsgNotEncrypted) + { + return mHtmlLoadExtOverride; + } + + return ((mHtmlLoadExternal && !mHtmlLoadExtOverride) || + (!mHtmlLoadExternal && mHtmlLoadExtOverride)); } -- cgit v1.2.1