Skip to content

Commit

Permalink
fix(vant-cli): decamelize ReDoS (#10351)
Browse files Browse the repository at this point in the history
* [Security] Fix ReDoS

Fix ReDoS

* Fix ReDoS

Fix ReDoS
  • Loading branch information
ready-research committed Mar 3, 2022
1 parent e9451af commit bc4e1cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vant-cli/site/common/index.js
Expand Up @@ -4,7 +4,7 @@ const isMobile = /ios|iphone|ipod|ipad|android/.test(ua);
export function decamelize(str, sep = '-') {
return str
.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
.replace(/([A-Z])([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
.toLowerCase();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/vant-cli/src/common/index.ts
Expand Up @@ -72,7 +72,7 @@ export function pascalize(str: string): string {
export function decamelize(str: string, sep = '-') {
return str
.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
.replace(/([A-Z])([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
.toLowerCase();
}

Expand Down

0 comments on commit bc4e1cd

Please sign in to comment.