diff options
| author | Liam Z <sethverlo5@gmail.com> | 2016-10-02 19:49:56 +0800 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-10-02 12:49:56 +0100 |
| commit | 514226e8c04ca483adff18bbad3a66f9b1593f07 (patch) | |
| tree | 0f468277a7135dca45227e0576c4508a4cf07fe4 /lib | |
| parent | 3eb1a5207b39b6150d828867cc684e5da94482f6 (diff) | |
Ignore v:imagedata elements without relationship ID with warning
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/docx/body-reader.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js index 732a8d2..4a1655e 100644 --- a/lib/docx/body-reader.js +++ b/lib/docx/body-reader.js @@ -340,9 +340,15 @@ function BodyReader(options) { } function readImageData(element) { - return readImage( - findEmbeddedImageFile(element.attributes["r:id"]), - element.attributes["o:title"]); + var relationshipId = element.attributes['r:id']; + + if (relationshipId) { + return readImage( + findEmbeddedImageFile(relationshipId), + element.attributes["o:title"]); + } else { + return emptyResultWithMessages([warning("A v:imagedata element without a relationship ID was ignored")]); + } } function findEmbeddedImageFile(relationshipId) { |
