detect actual filename of document xml (prevent mismatching document22.xml as in #1253)

This commit is contained in:
Martin Hanzl 2018-10-11 08:55:38 +02:00
parent 18760620b3
commit 7f55816eba
1 changed files with 7 additions and 1 deletions

View File

@ -507,7 +507,13 @@ class TemplateProcessor
*/ */
protected function getMainPartName() protected function getMainPartName()
{ {
return 'word/document.xml'; $contentTypes = $this->zipClass->getFromName('[Content_Types].xml');
$pattern = '~PartName="\/(word\/document.*?\.xml)" ContentType="application\/vnd\.openxmlformats-officedocument\.wordprocessingml\.document\.main\+xml"~';
preg_match($pattern, $contentTypes, $m);
return (array_key_exists(1, $m) ? $m[1] : 'word/document.xml');
} }
/** /**