-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix: don't include paths starting with Windows drive letters as endpoints #74
Conversation
707a80f
to
b43c829
Compare
b43c829
to
8736f5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WFM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this change! Just one question about Windows drive letters before we merge it. What do you think?
jgo/jgo.py
Outdated
@@ -265,7 +265,7 @@ def run_and_combine_outputs(command, *args): | |||
|
|||
def find_endpoint(argv, shortcuts={}): | |||
# endpoint is first positional argument | |||
pattern = re.compile(".*https?://.*") | |||
pattern = re.compile("(.*https?://.*|\S:\\.*)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is \S
too general? I am not a Windows expert (especially the latest versions of Windows), but IIUC, you are limited to 26 drive letters A through Z. So better to use [A-Z]
rather than \S
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is correct. I just pushed a change, to use [a-zA-Z]
instead, since Windows paths aren't case sensitive. Thanks for taking a look at this!
Thanks @cmhulbert! And thanks @jayvdb for testing. |
When an argument passed to jgo starts with a windows drive letter (e.g. Z:\), it detects this as a valid endpoint, and the endpoint index is much farther than it otherwise should be. This results in the last positional arg jgo attempts to parse to receive all the extra arguments, that should have otherwise been passed to the program jgo is launching. In my case, it was passing these extra args to the
-r
orrepository
flag, and failing since the windows paths were not valid maven repositories.There already was present a check to ignore args that match
Endpoint.is_endpoint
but containhttps://
, so I added an additional check to ignore an arg starting with a windows drive letter when considering the endpoint index.