fix(vscode/open): remove leading slash from folder URI#388
Conversation
Signed-off-by: Samuel K <skevetter@pm.me>
📝 WalkthroughWalkthroughRenamed Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@pkg/ide/vscode/open.go`:
- Line 196: The browser URL construction in openViaBrowser uses params.Folder
directly which can produce a double slash; update the fmt.Sprintf call in
openViaBrowser to trim a leading slash from params.Folder (use
strings.TrimPrefix(params.Folder, "/")) so it matches the earlier change to args
(the fmt.Sprintf that builds
"--folder-uri=vscode-remote://ssh-remote+%s.devpod/%s"); ensure you import or
reference strings as used elsewhere and replace params.Folder in the format
string with the trimmed value so CLI and browser URIs are consistent.
Signed-off-by: Samuel K <skevetter@pm.me>
Signed-off-by: Samuel K <skevetter@pm.me>
Signed-off-by: Samuel K <skevetter@pm.me>
Signed-off-by: Samuel K <skevetter@pm.me>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@pkg/ide/vscode/open.go`:
- Around line 105-110: The code uses path.Join to build VS Code remote URIs
which collapses the "://" scheme; in openViaBrowser (openURL) and in
buildOpenArgs (the argument built at line 202) stop using path.Join for the
scheme portion — instead concatenate the scheme and "://" (config.protocol +
"://") with the rest of the URL, and use path.Join only for the path segments
(e.g., join "vscode-remote", "ssh-remote+<Workspace>.devpod", and
strings.TrimPrefix(params.Folder, "/") into the path part), then prepend the
scheme + "://" so the final URI preserves the correct "vscode://" or
"vscode-remote://" form; update both openURL construction and the buildOpenArgs
URI construction accordingly, referencing openViaBrowser/openURL and
buildOpenArgs by name.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Pull request overview
This pull request aims to fix VS Code remote SSH URI formatting by removing leading slashes from folder paths to ensure workspace paths are handled consistently when opening VS Code remotely.
Changes:
- Refactored
openViaBrowserfunction to useurl.URLstruct for more reliable URL construction - Modified
buildOpenArgsfunction to strip leading slashes from folder paths and separate the--folder-uriflag from its value
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Samuel K <skevetter@pm.me>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@pkg/ide/vscode/open.go`:
- Around line 105-109: The path assembly in open.go duplicates the folder:
params.Folder is inserted into pathStr via fmt.Sprintf and then appended again;
update the logic around the local variables folder and pathStr so the folder
appears only once (e.g., use folder := strings.TrimPrefix(params.Folder, "/")
and build pathStr with fmt.Sprintf("/ssh-remote+%s.devpod/%s", params.Workspace,
folder) and remove the subsequent if folder != "" { pathStr += "/" + folder }
block), and ensure empty folder yields a clean path (or use a single join
operation like path.Join semantics) so params.Workspace and folder are correctly
combined without duplication.
Signed-off-by: Samuel K <skevetter@pm.me>
Signed-off-by: Samuel K skevetter@pm.me
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.