Skip to content

Conversation

@mre
Copy link
Member

@mre mre commented Sep 3, 2025

This commit fixes issue #972 where Windows absolute paths like C:\path were incorrectly parsed as URLs with scheme C:.

I also took that as an opportunity to finaly remove the assumption that non-existent inputs get parsed as HTTP URLs. So an input foo would previously have been automatically converted to http://foo/, which is a bold and mostly incorrect presumption. You can read more about it in the issue here.

Key changes in this PR:

  • Added WindowsPath newtype with proper detection using pattern matching
  • Moved Windows path logic to separate submodule for better organization
  • Removed automatic HTTP assumption (foo -> http://foo/)
  • Added InvalidInput error type with helpful error messages
  • Updated all tests to reflect new behavior

Fixes #972 and #1595

@mre mre force-pushed the absolute-local-windows-paths branch from f2dd6d8 to fc853d6 Compare September 3, 2025 22:35
This commit fixes issue #972 where Windows absolute paths like C:\path were incorrectly parsed as URLs with scheme C:.

Key changes:
- Added WindowsPath newtype with proper detection using pattern matching
- Moved Windows path logic to separate submodule for better organization
- Removed automatic HTTP assumption (foo -> http://foo/)
- Added InvalidInput error type with helpful error messages
- Updated all tests to reflect new behavior

Fixes #972
@mre mre force-pushed the absolute-local-windows-paths branch from fc853d6 to 3afb65e Compare September 3, 2025 22:36
mre added 3 commits September 4, 2025 00:38
- Replace From<WindowsPath> for PathBuf with as_path() method for better API
- Move WindowsPath unit tests to the windows_path module for better organization
- Fix unused import warning
@mre mre force-pushed the absolute-local-windows-paths branch from a438f5f to fc666f7 Compare September 3, 2025 22:50
- Update test_inputs_without_scheme to expect failure for domain-like inputs
- Refine Unix path detection logic to properly handle skip_missing behavior
- File-like inputs (containing hyphens, slashes) are treated as paths for skip_missing
- Domain-like inputs and simple words still fail with helpful error messages
- Change WindowsPath::try_from to return Result with descriptive error messages

All tests now pass including CLI integration tests.
@mre mre force-pushed the absolute-local-windows-paths branch from 5e502bf to 2e31400 Compare September 3, 2025 23:04
Update test expectation to match new error message format.
The error now occurs during file content reading rather than input parsing,
which is the correct behavior for relative paths.
@katrinafyi
Copy link
Contributor

I have quick comments. The first, and easiest, is that lowercase drive letters should be permitted. The second is that I think that the Unix and Windows logic should be unified so Windows also gains helpful hints like the full URL suggestion. The third is that (imo) it would be preferable to avoid custom WindowsPath parsing and logic. Windows paths are notoriously complicated. Is there a reason why using PathBuf on Windows is not sufficient? Is there a need to recognise windows paths on Unix platforms?

It would also be nice if there was a CI job to run windows tests.

@mre
Copy link
Member Author

mre commented Sep 8, 2025

Thanks for the feedback; I'll look into it.

@mre mre added the triage label Sep 23, 2025
@mre
Copy link
Member Author

mre commented Oct 9, 2025

Sorry for dropping the ball on this. Just a reminder what needs to be done so that I can quickly jump back in when I find the time:

  • rebase
  • support lowercase Windows paths
  • Try to unify Unix and Windows logic
  • Try to use PathBuf for Windows instead of WindowsPath

@thomas-zahner thomas-zahner force-pushed the master branch 2 times, most recently from fcdf77c to e0912ab Compare October 21, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Absolute local paths on Windows not recognized

3 participants