Repository navigation
fix: treat single-character (Windows drive-letter) schemes as local in is_remote_path - #1873
Open
faresrafat3 wants to merge 1 commit into
Conversation
…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
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
helpers.is_remote_pathusedurlparse().schemeand only excluded a drive letter followed by a backslash. On Windows, basepaths written with forward slashes (C:/data) were misclassified as remote URLs, soRemotePlugintried to fetch a local file over HTTP.Align
is_remote_pathwithparse_scheme_and_format: a scheme shorter than two characters is not a real URL scheme (empty or single-letter drive letter), so returnFalse.Root cause
urlparse('C:/data').schemereturns'c'. The original code checkedpath.lower().startswith(scheme + ':\')which only matched backslash paths. Forward-slash Windows paths slipped through and were treated as remote.parse_scheme_and_formatalready handled this viaif len(scheme) < 2. The two helpers disagreed about the same path.Verification
is_remote_path('C:/data')now returnsFalse(wasTrue)is_remote_path('C:\data')still returnsFalseis_remote_path('https://example.com/data.csv')still returnsTruefrictionless/helpers/__spec__/test_general.pyruff checkpasses on changed fileCloses #1872