diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-06-06 11:32:02 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-06-23 16:41:18 +0200 |
commit | de2d6e773212c983dc190d1d29d005de87df6ffd (patch) | |
tree | 1c59d43d93e09be5ea05d4166dcfecc3ebafa230 /oox | |
parent | 6f93c2519940b8e0afb7c50cacf06b2addfc873b (diff) |
Related: tdf#108269 oox: ignore case when checking .docm extension
Also check for ".docm", not "docm" as a suffix.
Change-Id: Ib9d3474cfe3139ee1ea51210a5606cd52243fee5
Reviewed-on: https://gerrit.libreoffice.org/38430
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 1c768b975827c74e58944b8b12ab254891389edc)
Reviewed-on: https://gerrit.libreoffice.org/38557
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/core/filterdetect.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index 50590f0469a6..8812e0c30c25 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -172,10 +172,19 @@ void FilterDetectDocHandler::parseRelationship( const AttributeList& rAttribs ) OUString FilterDetectDocHandler::getFilterNameFromContentType( const OUString& rContentType, const OUString& rFileName ) { - if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" && !rFileName.endsWith("docm") ) + bool bDocm = false; + OUString aDocmExtension = ".docm"; + if (rFileName.getLength() >= aDocmExtension.getLength()) + { + OUString aExtension = rFileName.copy(rFileName.getLength() - aDocmExtension.getLength()); + // The file name ends with .docm, ignoring case. + bDocm = aExtension.equalsIgnoreAsciiCase(aDocmExtension); + } + + if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" && !bDocm ) return OUString( "writer_MS_Word_2007" ); - if( rContentType == "application/vnd.ms-word.document.macroEnabled.main+xml" || rFileName.endsWith("docm") ) + if( rContentType == "application/vnd.ms-word.document.macroEnabled.main+xml" || bDocm ) return OUString( "writer_MS_Word_2007_VBA" ); if( rContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml" || |