From 1298c1d13572c6fbfbabb813b2d6843368c6df1f Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky <momonasmon@gmail.com> Date: Thu, 28 Aug 2014 23:35:33 +0300 Subject: We don't check the extension for html ...since 86c6f18c2766aad43d6e3bfcf3530e40440ebca7, so move the related code and comment to the plain text scope. Change-Id: I501ebaba915ddaa3f5d1d8d2977d3ba70fb6071b --- filter/source/textfilterdetect/filterdetect.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/filter/source/textfilterdetect/filterdetect.cxx b/filter/source/textfilterdetect/filterdetect.cxx index 1d29dd45cc5d..0b7ae1fc8994 100644 --- a/filter/source/textfilterdetect/filterdetect.cxx +++ b/filter/source/textfilterdetect/filterdetect.cxx @@ -125,12 +125,6 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal OUString aType = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_TYPENAME(), OUString() ); OUString aDocService = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_DOCUMENTSERVICE(), OUString() ); - OUString aUrl = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), OUString() ); - - // Get the file name extension. - INetURLObject aParser(aUrl); - OUString aExt = aParser.getExtension(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET); - aExt = aExt.toAsciiLowerCase(); if ((aType == "generic_HTML") || (aType == "calc_HTML")) { @@ -138,9 +132,6 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal if (!xInStream.is() || !IsHTMLStream(xInStream)) return OUString(); - // Decide which filter to use based on the document service first, - // then on extension if that's not available. - if ((aDocService == CALC_DOCSERVICE) || (aType == "calc_HTML")) aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_HTML_FILTER); else if (aDocService == WRITER_DOCSERVICE) @@ -151,6 +142,13 @@ OUString SAL_CALL PlainTextFilterDetect::detect(uno::Sequence<beans::PropertyVal else if (aType == "generic_Text") { + // Get the file name extension. + INetURLObject aParser(aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), OUString() ) ); + OUString aExt = aParser.getExtension(INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET); + aExt = aExt.toAsciiLowerCase(); + + // Decide which filter to use based on the document service first, + // then on extension if that's not available. if (aDocService == CALC_DOCSERVICE) aMediaDesc[MediaDescriptor::PROP_FILTERNAME()] <<= OUString(CALC_TEXT_FILTER); else if (aDocService == WRITER_DOCSERVICE) -- cgit