aboutsummaryrefslogtreecommitdiff
path: root/lib/docx/files.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2025-09-10 15:55:27 +0100
committerMichael Williamson <mike@zwobble.org>2025-09-10 15:55:27 +0100
commit1494d3c3a6283a00701ac452b8a9a5f8f2f4e9dd (patch)
tree4e4467490b883fe075094a25ba28f05e62d21393 /lib/docx/files.js
parent162324eb530d781aa59acce597997646ee59d1eb (diff)
Support disabling external file access
Diffstat (limited to 'lib/docx/files.js')
-rw-r--r--lib/docx/files.js9
1 files changed, 9 insertions, 0 deletions
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) {