mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
fix(core): Use safe primordials wrappers (#18687)
This commit is contained in:
parent
136dce67ce
commit
f086ec57b4
22 changed files with 83 additions and 60 deletions
|
@ -22,12 +22,12 @@ const {
|
|||
ArrayPrototypePush,
|
||||
ArrayPrototypeSlice,
|
||||
ArrayPrototypeSplice,
|
||||
Map,
|
||||
MapPrototypeGet,
|
||||
MapPrototypeSet,
|
||||
MathRandom,
|
||||
ObjectFreeze,
|
||||
ObjectPrototypeIsPrototypeOf,
|
||||
SafeMap,
|
||||
SafeRegExp,
|
||||
Symbol,
|
||||
StringFromCharCode,
|
||||
|
@ -346,13 +346,15 @@ function formDataToBlob(formData) {
|
|||
});
|
||||
}
|
||||
|
||||
const QUOTE_CONTENT_PATTERN = new SafeRegExp(/^"([^"]*)"$/);
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @returns {Map<string, string>}
|
||||
*/
|
||||
function parseContentDisposition(value) {
|
||||
/** @type {Map<string, string>} */
|
||||
const params = new Map();
|
||||
const params = new SafeMap();
|
||||
// Forced to do so for some Map constructor param mismatch
|
||||
const values = ArrayPrototypeSlice(StringPrototypeSplit(value, ";"), 1);
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
|
@ -361,7 +363,7 @@ function parseContentDisposition(value) {
|
|||
MapPrototypeSet(
|
||||
params,
|
||||
entries[0],
|
||||
StringPrototypeReplace(entries[1], /^"([^"]*)"$/, "$1"),
|
||||
StringPrototypeReplace(entries[1], QUOTE_CONTENT_PATTERN, "$1"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue