aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2018-01-23 21:30:32 +0000
committerMichael Williamson <mike@zwobble.org>2018-01-23 21:30:32 +0000
commit35bf2bbed6bae48ff87fcf3f39d176060ef95866 (patch)
tree000c7886352a6fafe984f603657b6e3a633dd4cc
parent2140507b59adb87353835f5a285da81edfdf8fa2 (diff)
Use word/document.xml as fallback
-rw-r--r--lib/docx/docx-reader.js3
-rw-r--r--test/docx/docx-reader.tests.js2
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/docx/docx-reader.js b/lib/docx/docx-reader.js
index 8423782..898da1d 100644
--- a/lib/docx/docx-reader.js
+++ b/lib/docx/docx-reader.js
@@ -81,7 +81,8 @@ function read(docxFile, input) {
}
function findDocumentFilename(docxFile, relationships) {
- var targets = ["word/document.xml"].concat(relationships.findTargetsByType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
+ var officeDocumentType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
+ var targets = relationships.findTargetsByType(officeDocumentType).concat(["word/document.xml"]);
var normalisedTargets = targets.map(function(target) {
return stripPrefix(target, "/");
});
diff --git a/test/docx/docx-reader.tests.js b/test/docx/docx-reader.tests.js
index f353930..5313906 100644
--- a/test/docx/docx-reader.tests.js
+++ b/test/docx/docx-reader.tests.js
@@ -44,7 +44,7 @@ var relationshipNamespaces = {
"r": "http://schemas.openxmlformats.org/package/2006/relationships"
};
-test("when document.xml is not present then document is found using _rels/.rels", function() {
+test("main document is found using _rels/.rels", function() {
var relationships = xml.element("r:Relationships", {}, [
xml.element("r:Relationship", {
"Type": "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",