mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Escape path separator when using it as part of a regexp. [closes #233]
Former-commit-id: 95d28187ee573ecc26e44f30cb5fb7457877dd06
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
var sep = path.sep;
|
||||
|
||||
// ensure relative paths are prefixed with `./`
|
||||
if (!RegExp('^\\.?' + sep).test(dirname)) {
|
||||
if (!RegExp('^\\.?' + sep.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).test(dirname)) {
|
||||
dirname = '.' + sep + dirname;
|
||||
}
|
||||
dirname.split(sep).reduce(function(currPath, segment) {
|
||||
|
||||
Reference in New Issue
Block a user