From 0e1968be4ab7cd99f7f588434f1304d9479dd91d Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Mon, 24 Aug 2020 16:50:48 +0000 Subject: [PATCH] Bug 1660560 - Hard-code fallback MIME-extension mappings for common Office formats and iCalendar. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D87918 --- .../exthandler/nsExternalHelperAppService.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index b3e117ec7a59..01fd8246430f 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -481,6 +481,29 @@ static const nsExtraMimeTypeEntry extraMimeEntries[] = { {"application/vnd.android.package-archive", "apk", "Android Package"}, #endif + // OpenDocument formats + {"application/vnd.oasis.opendocument.text", "odt", "OpenDocument Text"}, + {"application/vnd.oasis.opendocument.presentation", "odp", + "OpenDocument Presentation"}, + {"application/vnd.oasis.opendocument.spreadsheet", "ods", + "OpenDocument Spreadsheet"}, + {"application/vnd.oasis.opendocument.graphics", "odg", + "OpenDocument Graphics"}, + + // Legacy Microsoft Office + {"application/msword", "doc", "Microsoft Word"}, + {"application/vnd.ms-powerpoint", "ppt", "Microsoft PowerPoint"}, + {"application/vnd.ms-excel", "xls", "Microsoft Excel"}, + + // Office Open XML + {"application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "docx", "Microsoft Word (Open XML)"}, + {"application/" + "vnd.openxmlformats-officedocument.presentationml.presentation", + "pptx", "Microsoft PowerPoint (Open XML)"}, + {"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "xlsx", "Microsoft Excel (Open XML)"}, + // Note: if you add new image types, please also update the list in // contentAreaUtils.js to match. {IMAGE_ART, "art", "ART Image"}, @@ -509,6 +532,7 @@ static const nsExtraMimeTypeEntry extraMimeEntries[] = { {TEXT_XML, "xml,xsl,xbl", "Extensible Markup Language"}, {TEXT_CSS, "css", "Style Sheet"}, {TEXT_VCARD, "vcf,vcard", "Contact Information"}, + {TEXT_CALENDAR, "ics", "iCalendar"}, {VIDEO_OGG, "ogv", "Ogg Video"}, {VIDEO_OGG, "ogg", "Ogg Video"}, {APPLICATION_OGG, "ogg", "Ogg Video"},