Skip to content
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

Changed basename extraction regex to support Windows paths. #816

Merged
merged 1 commit into from
Oct 16, 2017
Merged

Changed basename extraction regex to support Windows paths. #816

merged 1 commit into from
Oct 16, 2017

Conversation

johnkord
Copy link
Contributor

No description provided.

Copy link
Contributor

@orlandohohmeier orlandohohmeier left a comment

Choose a reason for hiding this comment

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

@johnkord thanks a lot for taking the time to address this issues. 💐 I'm more than happy to merge your fix once you've addressed the minor comment regarding the used regular expression.

(Windows) path. The basename will be found in index 0 if it is
a forward slash path. A backslash path will also match in index 0,
but it will not contain the basename. */
var basename_match = /[a-zA-Z]:.*\\([^\\]+\\?$)|[^\/]+\/?$/.exec(
Copy link
Contributor

Choose a reason for hiding this comment

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

The pattern and condition looks unnecessary complex. The following pattern should be sufficient to also extract the basename from Windows path.

/[^/\\]+[/\\]{0,2}$/

Side Note: I wonder why decided to include ending slashes. It might makes sense to add a capture group to only get the name. /([^/\\]+)[/\\]{0,2}$/.exec(file.path)[1]

@johnkord
Copy link
Contributor Author

johnkord commented Oct 12, 2017

Thanks, great advice! I've submitted the requested change and have tested and verified the associated tests pass and the stderr/stdout links work with both Linux and Windows agents. @orlandohohmeier

@johnkord
Copy link
Contributor Author

Pinging @orlandohohmeier to let you know that this is ready for re-review, when you get a chance :)

@orlandohohmeier
Copy link
Contributor

LGTM 💯 ✨

@orlandohohmeier orlandohohmeier merged commit f811b3b into mesosphere:master Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants