Skip to content

Conversation

@cmhulbert
Copy link
Contributor

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 or repository 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 contain https://, so I added an additional check to ignore an arg starting with a windows drive letter when considering the endpoint index.

@cmhulbert cmhulbert force-pushed the fix/endpointsOnWindows branch from 707a80f to b43c829 Compare July 15, 2022 04:06
@cmhulbert
Copy link
Contributor Author

coincidentally relates to #75 and #76

Copy link
Contributor

@jayvdb jayvdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WFM

Copy link
Member

@ctrueden ctrueden left a 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
def find_endpoint(argv, shortcuts={}):
# endpoint is first positional argument
pattern = re.compile(".*https?://.*")
pattern = re.compile("(.*https?://.*|\S:\\.*)")
Copy link
Member

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?

Copy link
Contributor Author

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!

@ctrueden ctrueden self-assigned this Jul 25, 2022
@ctrueden ctrueden merged commit 4259eca into scijava:master Jul 31, 2022
@ctrueden
Copy link
Member

Thanks @cmhulbert! And thanks @jayvdb for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants