aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLiam Z <sethverlo5@gmail.com>2016-10-02 19:49:56 +0800
committerMichael Williamson <mike@zwobble.org>2016-10-02 12:49:56 +0100
commit514226e8c04ca483adff18bbad3a66f9b1593f07 (patch)
tree0f468277a7135dca45227e0576c4508a4cf07fe4 /lib
parent3eb1a5207b39b6150d828867cc684e5da94482f6 (diff)
Ignore v:imagedata elements without relationship ID with warning
Diffstat (limited to 'lib')
-rw-r--r--lib/docx/body-reader.js12
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) {