-
-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Absolute local paths on Windows not recognized #972
Comments
this indeed is a bug. Windows path is technically URL and the lychee tries to parse the argument as URL before parse it as a file path. And in the case the drive is mistaken as a scheme. A simple workaround is to change the said order. But it won't work because someone may name a drive as "http". so "http:\foo.bar\xyz" becomes both a legit Windows file path and a legit URL. The true solution is: Totally ban positional arguments. If you want to supply a file path, use --file, if you want to supply a glob, use --glob, etc. |
Windows drive names can only be letters But yeah, I agree that paths/URLs are a mess and it's best to explicitly distinguish them! |
in my made-up example
False. It doesn't have to contain double slash. Examples
|
Yes sorry, I was incorrect about the double slashes. However Windows doesn't really have drive names, only drive letters afaik. |
okay after some research it turns out you're right. on windows the drive letter must be one of A-Z. (for example see https://learn.microsoft.com/en-us/windows-server/storage/disk-management/change-a-drive-letter) So we can indeed guess whether a positional argument is a absolute path with drive on Windows. |
Can we collect a few test cases and the expected outcome here? |
we really should not abuse positional argument even though we can guess whether it's a file path or a URL. I think in most cases people invoke lychee against specific files or a glob pattern, so the practical choice is to allow path and glob as the positional argument. directly providing a URL to lychee is a niche case actually. it should either be done with a keyword argument or we simply remove this feature altogether. |
FWIW, you can workaround this with using drive relative paths - which basically look like standard POSIX paths. So, assuming the working directory is on the |
Sorry if I am using it wrong or it's duplicate report.
Running lychee (lychee-v0.11.1-windows-x86_64) on a local absolute path on Windows gives the following error:
Running it from that directory with
lychee.exe .
works!The text was updated successfully, but these errors were encountered: