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

Escape __dirname before generating regexp #191

Merged
merged 1 commit into from
Oct 19, 2018
Merged

Escape __dirname before generating regexp #191

merged 1 commit into from
Oct 19, 2018

Conversation

mcollina
Copy link
Collaborator

Fixes #190

Copy link
Contributor

@goto-bus-stop goto-bus-stop left a comment

Choose a reason for hiding this comment

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

LGTM with non-blocking suggestion 👍


const preloadDirRx = RegExp(join(__dirname, 'preload'))
const preloadDirRx = RegExp(join(escape(__dirname), 'preload'))
Copy link
Contributor

@goto-bus-stop goto-bus-stop Oct 19, 2018

Choose a reason for hiding this comment

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

This won't escape windows-path\preload, but I don't think that's a problem… escape(join()) would make sure the entire thing is escaped, regardless

Suggested change
const preloadDirRx = RegExp(join(escape(__dirname), 'preload'))
const preloadDirRx = RegExp(escape(join(__dirname, 'preload')))

Copy link
Contributor

@goto-bus-stop goto-bus-stop Oct 19, 2018

Choose a reason for hiding this comment

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

Actually escaping before joining does introduce more backslashes which may be a problem for unicodey windows paths or network drives? I'm not really familiar with them, just know that there's a bunch of \\?\\whatever going on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

escaping after joining does not work. I tried that first.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, that's unintuitive. Alright 👍

@mcollina mcollina merged commit c5db278 into master Oct 19, 2018
@mcollina mcollina deleted the fix-ticks-win branch October 19, 2018 13:42
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