Skip to content

fix(copy): split instance paths at the first colon like scp - #538

Open
0z5a wants to merge 1 commit into
brevdev:mainfrom
0z5a:fix/copy-colon-paths
Open

0z5a wants to merge 1 commit into
brevdev:mainfrom
0z5a:fix/copy-colon-paths

Conversation

@0z5a

@0z5a 0z5a commented Nov 17, 2026

Copy link
Copy Markdown

brev copy parsed instance:path with strings.Split(path, ":") and required exactly two parts. As a result a remote path containing a colon (for example a timestamped log my-instance:/logs/run-12:30:00.log) was rejected with invalid instance path format, and a local path with a colon after a / (./out/run-12:30.log) was taken as an instance named ./out/run-12.

This change splits at the first colon and, like scp, treats an argument as local when a / appears before the colon. The remote path is still passed to rsync/scp as alias:path, which both split at the first colon, so paths with colons now transfer as expected. An argument without a colon, or with a leading :, is handled as before.

parseWorkspacePath can no longer fail, so it no longer returns an error. The old TestParseWorkspacePath_InvalidMultipleColons test asserted the rejection and is replaced by tests for a colon in the remote path and in the local path.

Fixes #537

Testing

  • go test ./pkg/cmd/copy/ passes; go vet and gofmt -l are clean.
  • The two new tests fail on main with invalid instance path format, use instance_name:/path and exactly one of source or destination must be an instance path.
  • With a stub remote shell on macOS arm64, rsync and scp (-O and the default SFTP mode) pass alias as the host and keep /logs/run-12:30:00.log intact; an upload of ./run-12:30.log also connects to alias.

This change was drafted with Claude Code (claude-opus-5-5); the test results above are from the runs described.

parseWorkspacePath split on every colon and required exactly two
parts, so remote paths with a colon (timestamped logs) were rejected
and local paths with a colon were parsed as instance names.

Split at the first colon and treat an argument as local when a "/"
comes before the colon, as scp does.

Fixes brevdev#537
@0z5a
0z5a requested a review from a team as a code owner November 17, 2026 16:26
Copilot AI balanced review requested due to automatic review settings November 17, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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.

brev copy rejects remote paths that contain a colon and treats local paths with a colon as instance names

2 participants