aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/DocumentConverter.java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2025-09-10 16:40:27 +0100
committerMichael Williamson <mike@zwobble.org>2025-09-10 16:40:27 +0100
commit444dc1b64c015197bf6b5219da9459bc0cf6f787 (patch)
treee34a6f67f643d5fd160d1465444ddd9c9b872439 /src/main/java/org/zwobble/mammoth/DocumentConverter.java
parent7ef256b4b287af758d5bad0912de7140a4f69fbf (diff)
Support disabling external file access
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/DocumentConverter.java')
-rw-r--r--src/main/java/org/zwobble/mammoth/DocumentConverter.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/org/zwobble/mammoth/DocumentConverter.java b/src/main/java/org/zwobble/mammoth/DocumentConverter.java
index 2dea8e8..c7dca20 100644
--- a/src/main/java/org/zwobble/mammoth/DocumentConverter.java
+++ b/src/main/java/org/zwobble/mammoth/DocumentConverter.java
@@ -61,6 +61,15 @@ public class DocumentConverter {
}
/**
+ * Source documents may reference files outside of the source document.
+ * Call this to disable access to any such external files during the conversion process.
+ * This is highly recommended when converting untrusted user input.
+ */
+ public DocumentConverter disableExternalFileAccess() {
+ return new DocumentConverter(options.disableExternalFileAccess());
+ }
+
+ /**
* By default, images are converted to {@code <img>} elements with the source included inline in the {@code src} attribute.
* Call this to change how images are converted.
*/