Skip to content

Commit 0fa24c2

Browse files
committed
feat: add validation for Windows paths in Docker bind mounts
1 parent ca844de commit 0fa24c2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/lsp_client/server/docker.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ def _parts(self) -> list[str]:
5050

5151
@classmethod
5252
def from_path(cls, path: Path) -> BindMount:
53-
return cls(source=str(path), target=str(path))
53+
absolute_path = path.resolve()
54+
55+
if absolute_path.drive:
56+
raise ValueError(
57+
f"Path '{absolute_path}' contains a drive letter, which is not supported "
58+
"for same-path bind mounts in Linux containers. "
59+
"On Windows, you must explicitly separate 'source' and 'target' paths."
60+
)
61+
62+
return cls(source=str(absolute_path), target=str(absolute_path))
5463

5564

5665
class VolumeMount(MountBase):

0 commit comments

Comments
 (0)