Supports loading of word files with images added on OneDrive #2246
+21
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add images by editing Word in OneDrive and download Word files locally
When loaded with
PhpOffice\PhpWord\IOFactory::load
Fixed a bug that caused
PhpOffice\PhpWord\Exception\InvalidImageException
.If you unzip a normal Word file with zip
/docProps
/word
/_rels
Image files are in the directory
It is saved as /word/media/xxx.png.
However, if it is a file with images added with OneDrive
/docProps
/media
/word
/_rels
It is stored in the media directory of the directory called
In
getRels
ofPhpOffice\PhpWord\Reader\Word2007 Since it is assumed that the image exists in the
/word/mediadirectory, The image in the
/media` directory could not be read and an error occurred.for that reason,
If a directory has a "/" at the beginning, it has been modified to refer to that directory.
Fixes #2245
Checklist:
composer run-script check --timeout=0
and no errors were reportedAn error was reported where it had nothing to do with the fix.
There was no description because it was a minor bug fix.