diff --git a/pom.xml b/pom.xml
index a110f35..f499e28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
org.cryptomator
fuse-nio-adapter
- 1.2.1
+ 1.2.2
FUSE-NIO-Adapter
Access resources at a given NIO path via FUSE.
https://github.com/cryptomator/fuse-nio-adapter
@@ -113,7 +113,7 @@
org.cryptomator
cryptofs
- 1.8.0
+ 1.9.0
test
diff --git a/src/main/java/org/cryptomator/frontend/fuse/mount/MacMounter.java b/src/main/java/org/cryptomator/frontend/fuse/mount/MacMounter.java
index afb5271..7a33e4d 100644
--- a/src/main/java/org/cryptomator/frontend/fuse/mount/MacMounter.java
+++ b/src/main/java/org/cryptomator/frontend/fuse/mount/MacMounter.java
@@ -7,8 +7,10 @@
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
@@ -32,6 +34,7 @@ class MacMounter implements Mounter {
private static final int[] OSXFUSE_MINIMUM_SUPPORTED_VERSION = new int[]{3, 8, 2};
private static final String OSXFUSE_VERSIONFILE_LOCATION = "/Library/Filesystems/osxfuse.fs/Contents/version.plist";
private static final String OSXFUSE_VERSIONFILE_XPATH = "/plist/dict/key[.='CFBundleShortVersionString']/following-sibling::string[1]";
+ private static final String PLIST_DTD_URL = "http://www.apple.com/DTDs/PropertyList-1.0.dtd";
@Override
public synchronized Mount mount(Path directory, EnvironmentVariables envVars) throws CommandFailedException {
@@ -103,7 +106,9 @@ private String getVersionString() {
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
XPath xPath = XPathFactory.newInstance().newXPath();
try (InputStream in = Files.newInputStream(plistFile, StandardOpenOption.READ)) {
- Document doc = domFactory.newDocumentBuilder().parse(in);
+ DocumentBuilder docBuilder = domFactory.newDocumentBuilder();
+ docBuilder.setEntityResolver(this::resolveEntity);
+ Document doc = docBuilder.parse(in);
NodeList nodeList = (NodeList) xPath.compile(OSXFUSE_VERSIONFILE_XPATH).evaluate(doc, XPathConstants.NODESET);
Node node = nodeList.item(0);
if (node == null) {
@@ -120,6 +125,15 @@ private String getVersionString() {
}
}
+ private InputSource resolveEntity(String publicId, String systemId) {
+ if (PLIST_DTD_URL.equals(systemId)) {
+ // load DTD from local resource. fixes https://github.com/cryptomator/fuse-nio-adapter/issues/40
+ return new InputSource(getClass().getResourceAsStream("/PropertyList-1.0.dtd"));
+ } else {
+ return null;
+ }
+ }
+
private static class MacMount extends AbstractMount {
private final ProcessBuilder revealCommand;
diff --git a/src/main/resources/PropertyList-1.0.dtd b/src/main/resources/PropertyList-1.0.dtd
new file mode 100644
index 0000000..d6feecd
--- /dev/null
+++ b/src/main/resources/PropertyList-1.0.dtd
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file