Skip to content

Fix Bind.parse for Windows drive paths written with forward slashes - #2652

Open
Develop-KIM wants to merge 1 commit into
docker-java:mainfrom
Develop-KIM:fix/bind-forward-slash-windows-drive
Open

Fix Bind.parse for Windows drive paths written with forward slashes#2652
Develop-KIM wants to merge 1 commit into
docker-java:mainfrom
Develop-KIM:fix/bind-forward-slash-windows-drive

Conversation

@Develop-KIM

Copy link
Copy Markdown

Problem

Bind.parse splits the spec on : unless the colon is followed by a backslash, which handles Windows paths written as C:\host:/container. But a Windows drive path written with forward slashes (C:/host:/container) has a drive-letter colon that isn't followed by a backslash, so it gets treated as a separator:

Bind.parse("C:/host:/container:rw")
  split ":(?!\\)"  ->  ["C", "/host", "/container", "rw"]   // 4 parts -> IllegalArgumentException

Docker itself accepts drive paths with either slash direction, so C:/... binds should parse the same as C:\....

Fix

Add a negative lookbehind so a leading <letter>: is not treated as a separator:

":(?!\\)"  ->  ":(?!\\)(?<!^[A-Za-z]:)"
Bind.parse("C:/host:/container:rw")  ->  ["C:/host", "/container", "rw"]   // path=C:/host, volume=/container, rw

Existing backslash paths are unaffected (their drive colon is still skipped by the (?!\\) lookahead).

Tests

Added three cases to BindTest for forward-slash drive paths (default / rw / ro,z). Full BindTest (41 tests) passes and the reactor build is green.

Note

One intentional behavior change: a bare a:b (single-letter relative host path) now parses as a drive prefix and is rejected, matching how Docker treats a leading <letter>:. Happy to adjust the scope if you'd prefer it narrower.


This was written with AI assistance (Claude); I've reviewed the change and tested it locally.

Bind.parse split the spec on ':' unless the colon was followed by a
backslash, so a Windows drive path written with forward slashes (e.g.
"C:/host:/container:rw") was split at the drive-letter colon and either
mis-parsed or rejected with IllegalArgumentException.

Add a negative lookbehind so a leading "<letter>:" is not treated as a
separator, covering both backslash and forward-slash drive paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Develop-KIM
Develop-KIM requested a review from a team as a code owner July 9, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant