Skip to content

fix(core): normalize workspace dir paths to file:// URIs#11561

Open
BillionClaw wants to merge 1 commit intocontinuedev:mainfrom
BillionClaw:clawoss/fix/11559-file-path-resolution
Open

fix(core): normalize workspace dir paths to file:// URIs#11561
BillionClaw wants to merge 1 commit intocontinuedev:mainfrom
BillionClaw:clawoss/fix/11559-file-path-resolution

Conversation

@BillionClaw
Copy link

@BillionClaw BillionClaw commented Mar 17, 2026

Description

Fixes #11559 - File Path Resolution Failure in Tools

When IDE extensions (e.g., IntelliJ on Linux) return workspace directories as plain file paths like /home/user/project instead of proper file:// URIs, the path resolution logic would produce incorrect double-prefixed paths like /home/user/home/user/project.

Root Cause

The resolveRelativePathInDir() and inferResolvedUriFromRelativePath() functions in core/util/ideUtils.ts expected workspace directories to always be in URI format (file:///home/user/project), but some IDE extensions return plain filesystem paths.

Fix

Added normalizeDirUri() helper that converts plain file paths to proper file:// URIs before joining with relative paths:

  • Handles Linux absolute paths (/home/user/project)
  • Handles Windows paths (C:\\Users\\project)
  • Passes through already-valid URIs unchanged
  • Handles vscode-remote:// and other schemes

Tests

Added core/util/ideUtils.vitest.ts with tests for:

  • normalizeDirUri() - URI passthrough, Linux paths, Windows paths, encoding
  • resolveRelativePathInDir() - normal case, bug case, regression guard
  • inferResolvedUriFromRelativePath() - normal case, bug case, regression guard

Checklist


Summary by cubic

Normalize workspace directory paths to file:// URIs to fix path resolution when IDEs return plain paths (e.g., IntelliJ on Linux). Prevents double-prefixed paths and ensures correct URI joining.

  • Bug Fixes
    • Added normalizeDirUri to convert Linux/Windows paths; passthrough for existing URIs and other schemes.
    • Updated resolveRelativePathInDir and inferResolvedUriFromRelativePath to normalize dir inputs.
    • Added tests for normalization and both resolution functions, including regression guards.

Written for commit da335b8. Summary will update on new commits.

Fixes continuedev#11559

When IDE extensions (e.g., IntelliJ on Linux) return workspace directories
as plain file paths like '/home/user/project' instead of proper file://
URIs, the path resolution logic would produce incorrect double-prefixed
paths like '/home/user/home/user/project'.

This change adds a normalizeDirUri() helper that converts plain file paths
to proper file:// URIs before joining with relative paths.

- Added normalizeDirUri() to handle Linux, Windows, and already-URI paths
- Updated resolveRelativePathInDir() and inferResolvedUriFromRelativePath()
- Added tests for the normalization and both resolution functions
@BillionClaw BillionClaw requested a review from a team as a code owner March 17, 2026 16:56
@BillionClaw BillionClaw requested review from RomneyDa and removed request for a team March 17, 2026 16:56
@github-actions
Copy link
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="core/util/ideUtils.ts">

<violation number="1" location="core/util/ideUtils.ts:31">
P2: UNC Windows workspace paths are not normalized to `file://` URIs, so network-share directories can still bypass the new fix and break relative-path URI resolution.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

}

// For Windows paths (C:\ or drive letters)
if (/^[a-zA-Z]:/.test(dirPath)) {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 17, 2026

Choose a reason for hiding this comment

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

P2: UNC Windows workspace paths are not normalized to file:// URIs, so network-share directories can still bypass the new fix and break relative-path URI resolution.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At core/util/ideUtils.ts, line 31:

<comment>UNC Windows workspace paths are not normalized to `file://` URIs, so network-share directories can still bypass the new fix and break relative-path URI resolution.</comment>

<file context>
@@ -6,6 +6,36 @@ import {
+  }
+
+  // For Windows paths (C:\ or drive letters)
+  if (/^[a-zA-Z]:/.test(dirPath)) {
+    const normalized = dirPath.replaceAll("\\", "/");
+    return `file:///${pathToUriPathSegment(normalized)}`;
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

File Path Resolution Failure in Tools

1 participant