diff options
Diffstat (limited to 'lib/docx')
| -rw-r--r-- | lib/docx/docx-reader.js | 4 | ||||
| -rw-r--r-- | lib/docx/files.js | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/docx/docx-reader.js b/lib/docx/docx-reader.js index 342ec46..f343dae 100644 --- a/lib/docx/docx-reader.js +++ b/lib/docx/docx-reader.js @@ -18,10 +18,12 @@ var commentsReader = require("./comments-reader"); var Files = require("./files").Files; -function read(docxFile, input) { +function read(docxFile, input, options) { input = input || {}; + options = options || {}; var files = new Files({ + externalFileAccess: options.externalFileAccess, relativeToFile: input.path }); diff --git a/lib/docx/files.js b/lib/docx/files.js index 4b09b69..cb8655c 100644 --- a/lib/docx/files.js +++ b/lib/docx/files.js @@ -13,6 +13,15 @@ exports.uriToPath = uriToPath; function Files(options) { + options = options || {}; + if (!options.externalFileAccess) { + return { + read: function(uri) { + return promises.reject(new Error("could not read external image '" + uri + "', external file access is disabled")); + } + }; + } + var base = options.relativeToFile ? dirname(options.relativeToFile) : null; function read(uri, encoding) { |
