Skip to content

fix: detect Windows drive letter in oci-layout reference with forward slashes - #1372

Open
arpitjain099 wants to merge 1 commit into
notaryproject:mainfrom
arpitjain099:fix/oci-layout-forward-slash-drive-letter
Open

arpitjain099 wants to merge 1 commit into
notaryproject:mainfrom
arpitjain099:fix/oci-layout-forward-slash-drive-letter

Conversation

@arpitjain099

Copy link
Copy Markdown

parseOCILayoutReference only treats a leading C: as a Windows drive letter when the third byte is a backslash, so --oci-layout C:/layouts/foo falls through to the generic tag split, producing path C and tag /layouts/foo. The user then gets a stat failure on a file named C instead of the "missing tag or digest" error this case is meant to produce. Windows accepts forward slashes in paths, and /layouts/foo cannot be a valid OCI tag, so no legitimate input is affected. The fix accepts either separator.

I added a table-driven test for the function covering both separators. The forward-slash no-reference case fails on main and passes with the change; the rest of cmd/notation is unaffected.

Scope is narrow: this only changes the error message a Windows user sees. The function is plain string parsing with no runtime.GOOS or filepath use, so the test drives the same code anywhere, but I ran it on macOS, not Windows.

AI assistance was used on this change and is disclosed in the commit trailer.

… slashes

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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