From b555f4e12b33193532d3e133a5b19cded523226e Mon Sep 17 00:00:00 2001 From: Jorg K Date: Wed, 6 Jun 2018 22:33:33 +0200 Subject: [PATCH] Bug 1466802 - Also open non-mailnews URLs in nsMessengerContentHandler::HandleContent. r=aceman --- mailnews/base/src/nsMessengerContentHandler.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mailnews/base/src/nsMessengerContentHandler.cpp b/mailnews/base/src/nsMessengerContentHandler.cpp index beec4acda3..7e19a7cd50 100644 --- a/mailnews/base/src/nsMessengerContentHandler.cpp +++ b/mailnews/base/src/nsMessengerContentHandler.cpp @@ -15,6 +15,7 @@ #include "plstr.h" #include "nsIMsgMailNewsUrl.h" #include "nsServiceManagerUtils.h" +#include "nsIURIMutator.h" nsMessengerContentHandler::nsMessengerContentHandler() { @@ -61,7 +62,19 @@ NS_IMETHODIMP nsMessengerContentHandler::HandleContent(const char * aContentType } else { - NS_WARNING("Trying to handle content that's not a nsIMsgMailNewsUrl?"); + // Not an nsIMsgMailNewsUrl, so maybe a file URL, like opening a + // message attachment (.eml file in a temp directory). + nsAutoCString scheme; + rv = aUri->GetScheme(scheme); + NS_ENSURE_SUCCESS(rv, rv); + if (scheme.Equals("file")) { + // Add a special bit like in MsgOpenFromFile(). + rv = NS_MutateURI(aUri) + .SetQuery(NS_LITERAL_CSTRING("type=application/x-message-display")) + .Finalize(aUri); + NS_ENSURE_SUCCESS(rv, rv); + } + rv = OpenWindow(aUri); } } }