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

Removed "hasMagic" check before escaping paths. #4931

Merged
merged 3 commits into from Sep 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/__tests__/fixtures/globs/a(b)/styles.css
@@ -0,0 +1 @@
a {}
1 change: 1 addition & 0 deletions lib/__tests__/standalone-globs.test.js
Expand Up @@ -21,6 +21,7 @@ describe('standalone globbing', () => {
// ref https://github.com/micromatch/micromatch#matching-features
const fixtureDirs = [
`[digit]/not-digits`,
`a(b)`,
`with spaces`,
`extglob!(s)`,
`got!negate/negate`,
Expand Down
12 changes: 5 additions & 7 deletions lib/standalone.js
Expand Up @@ -172,14 +172,12 @@ module.exports = function (options) {
}

fileList = fileList.map((entry) => {
if (globby.hasMagic(entry)) {
const cwd = _.get(globbyOptions, 'cwd', process.cwd());
const absolutePath = !path.isAbsolute(entry) ? path.join(cwd, entry) : path.normalize(entry);
const cwd = _.get(globbyOptions, 'cwd', process.cwd());
const absolutePath = !path.isAbsolute(entry) ? path.join(cwd, entry) : path.normalize(entry);

if (fs.existsSync(absolutePath)) {
// This glob-like path points to a file. Return an escaped path to avoid globbing
return fastGlob.escapePath(entry);
}
if (fs.existsSync(absolutePath)) {
// This path points to a file. Return an escaped path to avoid globbing
return fastGlob.escapePath(entry);
}

return entry;
Expand Down