Bug 216308 - Avoid unwanted prompt to subscribe to IMAP folder when imap: URL is found in image src. r+a=jorgk
authorGene Smith <gds@chartertn.net>
Mon, 14 Oct 2019 00:02:31 +0200
changeset 36700 e822d43d62ee6ab63c1a42809ecb5f62c379db2e
parent 36699 da7293d2585079af2a9e4a89d6e211274d93c405
child 36701 629a054c868f3ee7dc7acb8af608e079865258c4
push id394
push userclokep@gmail.com
push dateMon, 21 Oct 2019 20:22:01 +0000
bugs216308
Bug 216308 - Avoid unwanted prompt to subscribe to IMAP folder when imap: URL is found in image src. r+a=jorgk
mailnews/imap/src/nsImapService.cpp
mailnews/imap/src/nsImapUrl.cpp
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2495,16 +2495,27 @@ NS_IMETHODIMP nsImapService::NewChannel(
     }
   }
   // the imap url holds a weak reference so we can pass the channel into the
   // imap protocol when we actually run the url.
   imapUrl->SetMockChannel(channel);
 
   bool externalLinkUrl;
   imapUrl->GetExternalLinkUrl(&externalLinkUrl);
+
+  // Only external imap links with no action are supported. Ignore links that
+  // attempt to cause an effect such as fetching a mime part. This avoids
+  // spurious prompts to subscribe to folders due to "imap://...Fetch..." links
+  // residing in legacy emails residing in an imap mailbox.
+  if (externalLinkUrl) {
+    nsImapAction imapAction;
+    imapUrl->GetImapAction(&imapAction);
+    if (imapAction != 0) externalLinkUrl = false;
+  }
+
   if (externalLinkUrl) {
     // everything after here is to handle clicking on an external link. We only
     // want to do this if we didn't run the url through the various
     // nsImapService methods, which we can tell by seeing if the sinks have been
     // setup on the url or not.
     nsCOMPtr<nsIMsgIncomingServer> server;
     rv = GetServerFromUrl(imapUrl, getter_AddRefs(server));
     NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/imap/src/nsImapUrl.cpp
+++ b/mailnews/imap/src/nsImapUrl.cpp
@@ -52,16 +52,17 @@ nsImapUrl::nsImapUrl() : mLock("nsImapUr
   m_moreHeadersToDownload = false;
   m_externalLinkUrl = true;  // we'll start this at true, and set it false in
                              // nsImapService::CreateStartOfImapUrl
   m_contentModified = IMAP_CONTENT_NOT_MODIFIED;
   m_validUrl = true;  // assume the best.
   m_flags = 0;
   m_extraStatus = ImapStatusNone;
   m_onlineSubDirSeparator = '/';
+  m_imapAction = 0;
 
   // ** jt - the following are not ref counted
   m_copyState = nullptr;
   m_file = nullptr;
   m_imapMailFolderSink = nullptr;
   m_imapMessageSink = nullptr;
   m_addDummyEnvelope = false;
   m_canonicalLineEnding = false;