-
Notifications
You must be signed in to change notification settings - Fork 38
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
CLI fails to handle Windows directory separators in command-line arguments #175
Comments
Error is triggered by globby/fast-glob (see sindresorhus/globby#130). The syntax only allows |
But is that better? AFAIK, |
That's why the search for the files first. If no file was found, it was not an escape attempt. I could only add a restriction to Windows systems. That would probably be even better. |
I would do const path = require('path');
if (path.sep !== '/') {
glob_path = original_path.replaceAll(path.sep, '/');
} else {
glob_path = original_path;
} |
And replaceAll is only available from NodeJS v15. But otherwise I use your suggestion |
Update with this change is published. thx |
When running the
httpyac
CLI on Windows, if you specify a path to a file that contains windows directory separators, i.e.\
, the CLI fails to locate the http file even if it exists and exits with an error message that states that the specified file could not be found.Whether the path argument is quoted or not does not change the behaviour if quoting is not necessary by the shell.
This happens in all cases where the path contains a directory separator, i.e.:
.\file-in-current-dir.http
subdir\file-in-subdir-relative-to-current-dir.http
C:\absolute-path-dir\file-in-absolute-dir.http
If you replace the windows-directory separator with a *NIX-like
/
the CLI finds the file and executes it as expected.If you execute the CLI from the directory the file is located in and specify only the file name, the path specified to the CLI no longer contains directory separators, and thus the CLI also find the file and executes it as expected.
The text was updated successfully, but these errors were encountered: