diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-06-06 11:32:02 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-06-07 04:41:06 +0200 |
commit | 81451bb88855e575fc9a2f5c1e91254c15f07cb9 (patch) | |
tree | d8fa4b1aaeb834966288c896e388ed15f21860fd /oox | |
parent | fc024618e56a392eb4a070573a7084950aeabdad (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/38459
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.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 226668dfc767..ed94ca5a5770 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -163,10 +163,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" || |