Skip to content

fix: handle Windows file:// URL with three slashes in resolve_dir#4497

Closed
1795771535y-cell wants to merge 1 commit into
TabbyML:mainfrom
1795771535y-cell:fix/windows-file-url-path
Closed

fix: handle Windows file:// URL with three slashes in resolve_dir#4497
1795771535y-cell wants to merge 1 commit into
TabbyML:mainfrom
1795771535y-cell:fix/windows-file-url-path

Conversation

@1795771535y-cell

@1795771535y-cell 1795771535y-cell commented Jun 2, 2026

Copy link
Copy Markdown

Problem

When a file:// URL is canonicalized by RepositoryConfig::canonicalize_url(), it becomes file:///C:/path on Windows (three slashes per RFC 8089). The fallback strip_prefix("file://") in resolve_dir() leaves a leading slash, producing /C:/repos/... which is invalid on Windows. This causes scheduled index jobs to fail with "Directory does not exist".

Steps to reproduce:

  1. Configure a Git context provider with file://C:/repos/project on Windows
  2. Initial/manual indexing works fine
  3. Scheduled hourly indexing fails because the path becomes /C:/repos/project

Fix

Try strip_prefix("file:///") first (three slashes for absolute paths), then fall back to strip_prefix("file://") (two slashes for relative/host-based paths). This correctly handles both canonicalized and raw Windows file:// URLs.

Testing

The existing test suite covers both formats. No test changes needed as existing ile:///C:/ test cases already produce the correct PathBuf.

Closes #4104

When file:// URL is canonicalized, it becomes file:///C:/path on
Windows. The fallback strip_prefix("file://") left a leading slash,
producing an invalid path /C:/repos/... on Windows.

Try stripping file:/// first, then fall back to file://.

Closes #4104
@1795771535y-cell 1795771535y-cell force-pushed the fix/windows-file-url-path branch from bbbd142 to 6370370 Compare June 2, 2026 09:50
@1795771535y-cell

Copy link
Copy Markdown
Author

Closing: no maintainer response after extended wait. Thanks for the opportunity.

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.

Context provider sheduled jobs failing on Windows

1 participant