From 5a39311f66e2491b7537e47ea932bca6e113c059 Mon Sep 17 00:00:00 2001 From: Richard North Date: Mon, 10 Apr 2017 20:39:08 +0100 Subject: [PATCH] Introduce an abstraction over files and classpath resources. This encapsulates all the complexity of generating a path that the Docker daemon is about to create a volume mount for. This should resolve a general problem with spaces in paths, which was seen in one particular form as #263. Additional tests for the specific problem in #263 will be added shortly. --- .../java/org/testcontainers/containers/GenericContainer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/testcontainers/containers/GenericContainer.java b/core/src/main/java/org/testcontainers/containers/GenericContainer.java index 167ea5864b9..cd35991d8e0 100644 --- a/core/src/main/java/org/testcontainers/containers/GenericContainer.java +++ b/core/src/main/java/org/testcontainers/containers/GenericContainer.java @@ -484,7 +484,7 @@ public void addEnv(String key, String value) { public void addFileSystemBind(String hostPath, String containerPath, BindMode mode) { final MountableFile mountableFile = MountableFile.forHostPath(hostPath); - binds.add(new Bind(mountableFile.getResolvedPath(), new Volume(containerPath), mode.accessMode)); + binds.add(new Bind(mountableFile.getMountablePath(), new Volume(containerPath), mode.accessMode)); } /** @@ -618,7 +618,7 @@ public SELF withNetworkMode(String networkMode) { public SELF withClasspathResourceMapping(String resourcePath, String containerPath, BindMode mode) { final MountableFile mountableFile = MountableFile.forClasspathResource(resourcePath); - this.addFileSystemBind(mountableFile.getResolvedPath(), containerPath, mode); + this.addFileSystemBind(mountableFile.getMountablePath(), containerPath, mode); return self(); }