Skip to content
This repository was archived by the owner on Dec 4, 2024. It is now read-only.

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 d2iq-archive:master Oct 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants