mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
lib: refactor to avoid unsafe regex primordials
PR-URL: https://github.com/nodejs/node/pull/43475 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
This commit is contained in:
parent
411fb21723
commit
a055337a02
39 changed files with 206 additions and 208 deletions
|
@ -9,8 +9,8 @@ const {
|
|||
PromiseReject,
|
||||
SafePromisePrototypeFinally,
|
||||
ReflectConstruct,
|
||||
RegExpPrototypeExec,
|
||||
RegExpPrototypeSymbolReplace,
|
||||
RegExpPrototypeTest,
|
||||
StringPrototypeToLowerCase,
|
||||
StringPrototypeSplit,
|
||||
Symbol,
|
||||
|
@ -165,7 +165,7 @@ class Blob {
|
|||
this[kLength] = length;
|
||||
|
||||
type = `${type}`;
|
||||
this[kType] = RegExpPrototypeTest(disallowedTypeCharacters, type) ?
|
||||
this[kType] = RegExpPrototypeExec(disallowedTypeCharacters, type) !== null ?
|
||||
'' : StringPrototypeToLowerCase(type);
|
||||
|
||||
// eslint-disable-next-line no-constructor-return
|
||||
|
@ -247,7 +247,7 @@ class Blob {
|
|||
end |= 0;
|
||||
|
||||
contentType = `${contentType}`;
|
||||
if (RegExpPrototypeTest(disallowedTypeCharacters, contentType)) {
|
||||
if (RegExpPrototypeExec(disallowedTypeCharacters, contentType) !== null) {
|
||||
contentType = '';
|
||||
} else {
|
||||
contentType = StringPrototypeToLowerCase(contentType);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue