From 2a551dd0dc3235e78bf3c94843d4107072d17841 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Wed, 27 Mar 2019 15:43:34 -0700 Subject: [PATCH] feat!: question marks are valid path characters on Windows so avoid flagging as a glob when alone --- README.md | 2 +- test/index.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f7fb21f..c7fbe32 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Takes a string and returns the part of the path before the glob begins. Be aware The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: -- `?` (question mark) +- `?` (question mark) unless used as a path segment alone - `*` (asterisk) - `|` (pipe) - `(` (opening parenthesis) diff --git a/test/index.test.js b/test/index.test.js index 2ce9c87..33f26f6 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -47,12 +47,12 @@ describe('glob-parent', function() { assert.equal(gp('path/*(to|from)'), 'path'); assert.equal(gp('path/@(to|from)'), 'path'); assert.equal(gp('path/!/foo'), 'path/!'); - assert.equal(gp('path/?/foo'), 'path', 'qmarks must be escaped'); + assert.equal(gp('path/?/foo'), 'path/?'); assert.equal(gp('path/+/foo'), 'path/+'); assert.equal(gp('path/*/foo'), 'path'); assert.equal(gp('path/@/foo'), 'path/@'); assert.equal(gp('path/!/foo/'), 'path/!/foo'); - assert.equal(gp('path/?/foo/'), 'path', 'qmarks must be escaped'); + assert.equal(gp('path/?/foo/'), 'path/?/foo'); assert.equal(gp('path/+/foo/'), 'path/+/foo'); assert.equal(gp('path/*/foo/'), 'path'); assert.equal(gp('path/@/foo/'), 'path/@/foo');