Skip to content

fix: exclude verify type of RegExp #112

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhangxiaoyu713
Copy link

add exclude verify type of RegExp:
if exclude type is Function, it has a bug
eg:
postCssPxToRem({
exclude: (filePath) => {
const reg = /src/pages/m|src/components/m|share/components/m/;
return !reg.test(filePath);
},
})
if we got a filePath: '/project/src/components/m/Button.scss', exclude(filePath) return false, but isExcludeFile will be true;
because filePath.match(exclude) !== null

if we pass a function to math, it will be potential risks:
console.log('abc'.match(() => { const reg = /a|b|c/; }))

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.

1 participant