Skip to content

fix: treat single-character (Windows drive-letter) schemes as local in is_remote_path - #1873

Open
faresrafat3 wants to merge 1 commit into
frictionlessdata:mainfrom
faresrafat3:fix/is-remote-path-windows-forward-slash-1872
Open

faresrafat3 wants to merge 1 commit into
frictionlessdata:mainfrom
faresrafat3:fix/is-remote-path-windows-forward-slash-1872

Conversation

@faresrafat3

Copy link
Copy Markdown

Summary of changes

helpers.is_remote_path used urlparse().scheme and only excluded a drive letter followed by a backslash. On Windows, basepaths written with forward slashes (C:/data) were misclassified as remote URLs, so RemotePlugin tried to fetch a local file over HTTP.

Align is_remote_path with parse_scheme_and_format: a scheme shorter than two characters is not a real URL scheme (empty or single-letter drive letter), so return False.

Root cause

urlparse('C:/data').scheme returns 'c'. The original code checked path.lower().startswith(scheme + ':\') which only matched backslash paths. Forward-slash Windows paths slipped through and were treated as remote. parse_scheme_and_format already handled this via if len(scheme) < 2. The two helpers disagreed about the same path.

Verification

  • is_remote_path('C:/data') now returns False (was True)
  • is_remote_path('C:\data') still returns False
  • is_remote_path('https://example.com/data.csv') still returns True
  • 26 tests pass in frictionless/helpers/__spec__/test_general.py
  • ruff check passes on changed file

Closes #1872

…n is_remote_path

is_remote_path used urlparse().scheme and only excluded a drive letter
followed by a backslash. On Windows, basepaths written with forward slashes
(C:/data) were misclassified as remote URLs, so RemotePlugin tried to
fetch a local file over HTTP.

Align is_remote_path with parse_scheme_and_format: a scheme shorter than
two characters is not a real URL scheme (empty or single-letter drive
letter), so return False. This matches the existing convention in
parse_scheme_and_format (general.py).

Refs frictionlessdata#1872
Copilot AI balanced review requested due to automatic review settings October 31, 2026 07:44

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.

This branch has not been deployed

No deployments
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.

Windows: basepath like C:/data is treated as a remote URL

2 participants