waveterm/pkg/remote/connparse
Copilot 68719988ea
Fix connparse handling for scheme-less //... WSH shorthand URIs (#3006)
`pkg/remote/connparse` was failing on shorthand WSH inputs that omit the
`wsh://` scheme, including remote hosts, WSL targets, and Windows local
paths. The parser was splitting on `://` too early and misclassifying
leading `//` inputs before WSH shorthand handling ran.

- **What changed**
- Detect scheme-less WSH shorthand up front with `strings.HasPrefix(uri,
"//")`
- Route those inputs through the existing WSH path parsing flow instead
of the generic `://` split path
- Reuse the same shorthand flag when deciding whether to parse as
remote/local WSH vs current-path shorthand

- **Behavioral impact**
- `//conn/path/to/file` now parses as host `conn` with path
`path/to/file`
- `//wsl://Ubuntu/path/to/file` now preserves the WSL host and absolute
path shape
- `//local/C:\path\to\file` now parses as local Windows shorthand
instead of being treated as a current-path string

- **Scope**
  - Keeps the existing test expectations intact
  - Limits the change to `pkg/remote/connparse/connparse.go`

```go
isWshShorthand := strings.HasPrefix(uri, "//")

if isWshShorthand {
    rest = strings.TrimPrefix(uri, "//")
} else if len(split) > 1 {
    scheme = split[0]
    rest = strings.TrimPrefix(split[1], "//")
}
```

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <mike@commandline.dev>
2026-03-06 17:55:55 -08:00
..
connparse.go Fix connparse handling for scheme-less //... WSH shorthand URIs (#3006) 2026-03-06 17:55:55 -08:00
connparse_test.go Fix connparse handling for scheme-less //... WSH shorthand URIs (#3006) 2026-03-06 17:55:55 -08:00