@zowe/db2-for-zowe-cli 6.1.18 → 6.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/adm-zip/adm-zip.js +32 -6
- package/node_modules/adm-zip/headers/entryHeader.js +13 -1
- package/node_modules/adm-zip/methods/inflater.js +33 -3
- package/node_modules/adm-zip/package.json +2 -2
- package/node_modules/adm-zip/util/errors.js +3 -0
- package/node_modules/adm-zip/util/utils.js +102 -14
- package/node_modules/adm-zip/zipEntry.js +43 -18
- package/node_modules/adm-zip/zipFile.js +10 -0
- package/node_modules/axios/README.md +41 -106
- package/node_modules/axios/dist/axios.js +931 -278
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +948 -268
- package/node_modules/axios/dist/esm/axios.js +948 -268
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +925 -242
- package/node_modules/axios/index.d.cts +20 -1
- package/node_modules/axios/index.d.ts +18 -1
- package/node_modules/axios/lib/adapters/fetch.js +73 -20
- package/node_modules/axios/lib/adapters/http.js +145 -26
- package/node_modules/axios/lib/adapters/xhr.js +120 -13
- package/node_modules/axios/lib/core/Axios.js +67 -12
- package/node_modules/axios/lib/core/AxiosError.js +59 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +17 -4
- package/node_modules/axios/lib/core/InterceptorManager.js +13 -2
- package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
- package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +20 -0
- package/node_modules/axios/lib/core/mergeConfig.js +183 -120
- package/node_modules/axios/lib/defaults/transitional.js +1 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
- package/node_modules/axios/lib/helpers/Http2Sessions.js +2 -1
- package/node_modules/axios/lib/helpers/composeSignals.js +6 -3
- package/node_modules/axios/lib/helpers/cookies.js +30 -6
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
- package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -1
- package/node_modules/axios/lib/helpers/fromDataURI.js +8 -2
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
- package/node_modules/axios/lib/helpers/parseHeaders.js +2 -1
- package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
- package/node_modules/axios/lib/helpers/resolveConfig.js +16 -3
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +16 -1
- package/node_modules/axios/lib/utils.js +61 -10
- package/node_modules/axios/package.json +1 -2
- package/node_modules/follow-redirects/README.md +27 -1
- package/node_modules/follow-redirects/index.js +11 -6
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/fs-extra/README.md +0 -1
- package/node_modules/fs-extra/lib/empty/index.js +4 -2
- package/node_modules/fs-extra/lib/util/stat.js +12 -2
- package/node_modules/fs-extra/package.json +1 -1
- package/node_modules/string_decoder/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/package.json +37 -0
- package/node_modules/which-typed-array/CHANGELOG.md +14 -0
- package/node_modules/which-typed-array/README.md +0 -2
- package/node_modules/which-typed-array/index.d.ts +288 -11
- package/node_modules/which-typed-array/index.js +6 -7
- package/node_modules/which-typed-array/package.json +12 -11
- package/package.json +1 -6
- package/node_modules/which-typed-array/eslint.config.mjs +0 -12
- package/node_modules/which-typed-array/test/index.js +0 -105
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/LICENSE +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/README.md +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/chownr.js +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/package.json +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/.travis.yml +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/LICENSE +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/README.md +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/lib/string_decoder.js +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/package.json +0 -0
|
@@ -65,6 +65,29 @@ function arrayToObject(arr) {
|
|
|
65
65
|
return obj;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function normalizeArray(value) {
|
|
69
|
+
if (!utils.isArray(value)) return value;
|
|
70
|
+
|
|
71
|
+
const keys = Object.keys(value);
|
|
72
|
+
return keys.length !== value.length || keys.some((key, index) => key !== String(index))
|
|
73
|
+
? arrayToObject(value)
|
|
74
|
+
: value;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function normalizeArrays(obj) {
|
|
78
|
+
const pending = [obj];
|
|
79
|
+
while (pending.length) {
|
|
80
|
+
const target = pending.pop();
|
|
81
|
+
Object.keys(target).forEach((key) => {
|
|
82
|
+
const value = (target[key] = normalizeArray(target[key]));
|
|
83
|
+
if (utils.isArray(value) || utils.isPlainObject(value)) {
|
|
84
|
+
pending.push(value);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return obj;
|
|
89
|
+
}
|
|
90
|
+
|
|
68
91
|
/**
|
|
69
92
|
* It takes a FormData object and returns a JavaScript object
|
|
70
93
|
*
|
|
@@ -86,6 +109,7 @@ function formDataToJSON(formData) {
|
|
|
86
109
|
|
|
87
110
|
if (isLast) {
|
|
88
111
|
if (utils.hasOwnProp(target, name)) {
|
|
112
|
+
target[name] = normalizeArray(target[name]);
|
|
89
113
|
target[name] = utils.isArray(target[name])
|
|
90
114
|
? target[name].concat(value)
|
|
91
115
|
: [target[name], value];
|
|
@@ -116,7 +140,7 @@ function formDataToJSON(formData) {
|
|
|
116
140
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
117
141
|
});
|
|
118
142
|
|
|
119
|
-
return obj;
|
|
143
|
+
return normalizeArrays(obj);
|
|
120
144
|
}
|
|
121
145
|
|
|
122
146
|
return null;
|
|
@@ -6,7 +6,10 @@ import platform from '../platform/index.js';
|
|
|
6
6
|
|
|
7
7
|
// RFC 2397: data:[<mediatype>][;base64],<data>
|
|
8
8
|
// mediatype = type/subtype followed by optional ;name=value parameters
|
|
9
|
-
|
|
9
|
+
// The `i` flag makes the `;base64` token case-insensitive, matching the WHATWG
|
|
10
|
+
// URL/Fetch data URL processor (and therefore the fetch adapter and browsers).
|
|
11
|
+
// The remaining character classes do not depend on letter case.
|
|
12
|
+
const DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/i;
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Parse data uri to a Buffer or Blob
|
|
@@ -51,7 +54,10 @@ export default function fromDataURI(uri, asBlob, options) {
|
|
|
51
54
|
|
|
52
55
|
const buffer =
|
|
53
56
|
encoding === 'base64'
|
|
54
|
-
? Buffer.from(
|
|
57
|
+
? Buffer.from(
|
|
58
|
+
body.replace(/%([\da-f]{2})/gi, (_, hex) => String.fromCharCode(parseInt(hex, 16))),
|
|
59
|
+
'base64'
|
|
60
|
+
)
|
|
55
61
|
: Buffer.from(decodeURIComponent(body), encoding);
|
|
56
62
|
|
|
57
63
|
if (asBlob) {
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import platform from '../platform/index.js';
|
|
2
2
|
|
|
3
3
|
export default platform.hasStandardBrowserEnv
|
|
4
|
-
? ((origin
|
|
5
|
-
url = new URL(url, platform.origin);
|
|
4
|
+
? ((origin) => (url) => {
|
|
5
|
+
url = new URL(url, document.baseURI || platform.origin);
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
|
-
origin.protocol === url.protocol &&
|
|
9
|
-
origin.host === url.host &&
|
|
10
|
-
(isMSIE || origin.port === url.port)
|
|
8
|
+
origin.protocol === url.protocol && origin.host === url.host && origin.port === url.port
|
|
11
9
|
);
|
|
12
|
-
})(
|
|
13
|
-
new URL(platform.origin),
|
|
14
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
15
|
-
)
|
|
10
|
+
})(new URL(platform.origin))
|
|
16
11
|
: () => true;
|
|
@@ -39,7 +39,8 @@ const ignoreDuplicateOf = utils.toObjectSet([
|
|
|
39
39
|
* @returns {Object} Headers parsed into an object
|
|
40
40
|
*/
|
|
41
41
|
export default (rawHeaders) => {
|
|
42
|
-
|
|
42
|
+
// Header names are data, including __proto__; avoid inherited setters.
|
|
43
|
+
const parsed = Object.create(null);
|
|
43
44
|
let key;
|
|
44
45
|
let val;
|
|
45
46
|
let i;
|
|
@@ -22,7 +22,9 @@ const encodeUTF8 = (str) =>
|
|
|
22
22
|
String.fromCharCode(parseInt(hex, 16))
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const readCookie = (name) => cookies.read(name);
|
|
26
|
+
|
|
27
|
+
function resolveConfig(config, readXsrfCookie = readCookie) {
|
|
26
28
|
const newConfig = mergeConfig({}, config);
|
|
27
29
|
|
|
28
30
|
// Read only own properties to prevent prototype pollution gadgets
|
|
@@ -51,11 +53,22 @@ function resolveConfig(config) {
|
|
|
51
53
|
if (auth) {
|
|
52
54
|
const username = utils.getSafeProp(auth, 'username') || '';
|
|
53
55
|
const password = utils.getSafeProp(auth, 'password') || '';
|
|
56
|
+
const transitional = own('transitional');
|
|
57
|
+
const encodeUsername =
|
|
58
|
+
transitional &&
|
|
59
|
+
utils.hasOwnProp(transitional, 'encodeBasicAuthUsername') &&
|
|
60
|
+
transitional.encodeBasicAuthUsername === true;
|
|
54
61
|
|
|
55
62
|
try {
|
|
56
63
|
headers.set(
|
|
57
64
|
'Authorization',
|
|
58
|
-
|
|
65
|
+
// Preserve legacy username bytes unless the caller opts in to UTF-8.
|
|
66
|
+
'Basic ' +
|
|
67
|
+
btoa(
|
|
68
|
+
(encodeUsername ? encodeUTF8(username) : username) +
|
|
69
|
+
':' +
|
|
70
|
+
(password ? encodeUTF8(password) : '')
|
|
71
|
+
)
|
|
59
72
|
);
|
|
60
73
|
} catch (e) {
|
|
61
74
|
throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);
|
|
@@ -93,7 +106,7 @@ function resolveConfig(config) {
|
|
|
93
106
|
withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
|
|
94
107
|
|
|
95
108
|
if (shouldSendXSRF) {
|
|
96
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName &&
|
|
109
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
|
|
97
110
|
|
|
98
111
|
if (xsrfValue) {
|
|
99
112
|
headers.set(xsrfHeaderName, xsrfValue);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { domainToASCII } from 'url';
|
|
2
|
+
|
|
1
3
|
const LOOPBACK_HOSTNAMES = new Set(['localhost', '0.0.0.0']);
|
|
2
4
|
|
|
3
5
|
const trimTrailingDots = (value) => {
|
|
@@ -319,7 +321,20 @@ const normalizeNoProxyHost = (hostname) => {
|
|
|
319
321
|
hostname = hostname.slice(1, -1);
|
|
320
322
|
}
|
|
321
323
|
|
|
322
|
-
|
|
324
|
+
let trimmed = trimTrailingDots(hostname);
|
|
325
|
+
if (trimmed.indexOf(':') !== -1) {
|
|
326
|
+
try {
|
|
327
|
+
trimmed = new URL('http://[' + trimmed + ']/').hostname.slice(1, -1);
|
|
328
|
+
} catch (_err) {
|
|
329
|
+
return trimmed;
|
|
330
|
+
}
|
|
331
|
+
} else if (/[\u0080-\uffff]/.test(trimmed)) {
|
|
332
|
+
const prefix = /^[*.]+/.exec(trimmed);
|
|
333
|
+
const start = prefix ? prefix[0] : '';
|
|
334
|
+
const ascii = domainToASCII(trimmed.slice(start.length));
|
|
335
|
+
if (!ascii) return '';
|
|
336
|
+
trimmed = start + trimTrailingDots(ascii);
|
|
337
|
+
}
|
|
323
338
|
|
|
324
339
|
// IPv4 shorthand/octal/hex → dotted-decimal; helper is a no-op for inputs
|
|
325
340
|
// containing ':' (IPv6 and IPv4-mapped IPv6) so we fall through to unmap.
|
|
@@ -313,11 +313,17 @@ const isPlainObject = (val) => {
|
|
|
313
313
|
const prototype = getPrototypeOf(val);
|
|
314
314
|
return (
|
|
315
315
|
(prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) &&
|
|
316
|
-
// Treat
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
|
|
320
|
-
|
|
316
|
+
// Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
|
|
317
|
+
// value is tagged/iterable, ignoring members reachable only through shared
|
|
318
|
+
// or terminal prototype boundaries. This is exactly what
|
|
319
|
+
// hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
|
|
320
|
+
// above (null, Object.prototype, or a terminal null-prototype template) is
|
|
321
|
+
// a boundary, so the walk never inspects anything but `val`'s own members,
|
|
322
|
+
// and stops before even those when `val` is itself the boundary
|
|
323
|
+
// Object.prototype. Checking that inline avoids allocating the walker's
|
|
324
|
+
// `seen` list twice per call on the mergeConfig / merge hot path.
|
|
325
|
+
(isPrototypeBoundary(val, prototype, true) ||
|
|
326
|
+
(!hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator)))
|
|
321
327
|
);
|
|
322
328
|
};
|
|
323
329
|
|
|
@@ -581,15 +587,30 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
581
587
|
function merge(...objs) {
|
|
582
588
|
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
583
589
|
const result = {};
|
|
590
|
+
// Caseless lookup only applies to string keys — symbol keys are
|
|
591
|
+
// identity-matched. Every string key that reaches `result` passes through
|
|
592
|
+
// this index first, so it can never hold two case variants of one key and a
|
|
593
|
+
// lowercase -> key map is exactly what findKey(result, key) would rescan
|
|
594
|
+
// Object.keys(result) for on each assignment.
|
|
595
|
+
const lowerCaseKeys = caseless ? Object.create(null) : null;
|
|
584
596
|
const assignValue = (val, key) => {
|
|
585
597
|
// Skip dangerous property names to prevent prototype pollution
|
|
586
598
|
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
587
599
|
return;
|
|
588
600
|
}
|
|
589
601
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
602
|
+
let targetKey = key;
|
|
603
|
+
if (lowerCaseKeys && typeof key === 'string') {
|
|
604
|
+
const lowerKey = key.toLowerCase();
|
|
605
|
+
const knownKey = lowerCaseKeys[lowerKey];
|
|
606
|
+
// A key recorded but absent from `result` was skipped by skipUndefined;
|
|
607
|
+
// the later spelling wins then, as it does for findKey.
|
|
608
|
+
if (knownKey !== undefined && hasOwnProperty(result, knownKey)) {
|
|
609
|
+
targetKey = knownKey;
|
|
610
|
+
} else {
|
|
611
|
+
lowerCaseKeys[lowerKey] = key;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
593
614
|
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
594
615
|
// chain, so a polluted Object.prototype value could surface here and get
|
|
595
616
|
// copied into the merged result.
|
|
@@ -613,7 +634,7 @@ function merge(...objs) {
|
|
|
613
634
|
|
|
614
635
|
forEach(source, assignValue);
|
|
615
636
|
|
|
616
|
-
if (typeof source !== 'object' || isArray(source)) {
|
|
637
|
+
if (typeof source !== 'object' || isArray(source) || !Object.getOwnPropertySymbols) {
|
|
617
638
|
continue;
|
|
618
639
|
}
|
|
619
640
|
|
|
@@ -772,7 +793,37 @@ const toArray = (thing) => {
|
|
|
772
793
|
if (!thing) return null;
|
|
773
794
|
if (isArray(thing)) return thing;
|
|
774
795
|
let i = thing.length;
|
|
775
|
-
if (!
|
|
796
|
+
if (!Number.isSafeInteger(i) || i < 0 || i > 0xffffffff) return null;
|
|
797
|
+
|
|
798
|
+
// Bound the copy by actual indexed properties, including hidden and inherited
|
|
799
|
+
// members of array-like collections, rather than by the declared length alone.
|
|
800
|
+
const indexes = new Set();
|
|
801
|
+
const seen = new Set();
|
|
802
|
+
let source = thing;
|
|
803
|
+
|
|
804
|
+
while (source != null && indexes.size < i) {
|
|
805
|
+
if (seen.has(source)) return null;
|
|
806
|
+
seen.add(source);
|
|
807
|
+
|
|
808
|
+
const prototype = getPrototypeOf(source);
|
|
809
|
+
if (isPrototypeBoundary(source, prototype, source === thing)) break;
|
|
810
|
+
|
|
811
|
+
Object.getOwnPropertyNames(source).forEach((key) => {
|
|
812
|
+
const index = +key;
|
|
813
|
+
if (
|
|
814
|
+
Number.isInteger(index) &&
|
|
815
|
+
index >= 0 &&
|
|
816
|
+
index < i &&
|
|
817
|
+
String(index) === key &&
|
|
818
|
+
hasOwnProperty(source, key)
|
|
819
|
+
) {
|
|
820
|
+
indexes.add(index);
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
source = prototype;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
if (indexes.size !== i) return null;
|
|
776
827
|
const arr = new Array(i);
|
|
777
828
|
while (i-- > 0) {
|
|
778
829
|
arr[i] = thing[i];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axios",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "Promise based HTTP client for the browser and node.js",
|
|
5
5
|
"main": "./dist/node/axios.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -161,7 +161,6 @@
|
|
|
161
161
|
"abortcontroller-polyfill": "^1.7.8",
|
|
162
162
|
"acorn": "^8.17.0",
|
|
163
163
|
"body-parser": "^2.3.0",
|
|
164
|
-
"chalk": "^5.6.2",
|
|
165
164
|
"cross-env": "^10.1.0",
|
|
166
165
|
"dev-null": "^0.1.1",
|
|
167
166
|
"eslint": "^10.6.0",
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
##
|
|
1
|
+
## _Follow Redirects_ is in need of funding
|
|
2
|
+
|
|
3
|
+
> [!IMPORTANT]
|
|
4
|
+
> **Maintenance paused until funding found.**
|
|
5
|
+
>
|
|
6
|
+
> follow-redirects is downloaded over 400 million times per month,
|
|
7
|
+
> It has been maintained for over ten years by one volunteer,
|
|
8
|
+
> who has no funds to provide update and security guarantees.
|
|
9
|
+
>
|
|
10
|
+
> **What this means for you:**
|
|
11
|
+
> the package stays published and keeps working as it does today,
|
|
12
|
+
> but there are no guarantees of bug fixes, security fixes,
|
|
13
|
+
> or replies to issues and pull requests.
|
|
14
|
+
> Security reports are handled best-effort only; see [SECURITY.md](SECURITY.md).
|
|
15
|
+
>
|
|
16
|
+
> **What can restart maintenance:**
|
|
17
|
+
> Even if only 0.1% of downloads paid $0.01, we'd be fully funded
|
|
18
|
+
> with $4000 per month.
|
|
19
|
+
> That's not the case, and that's okay,
|
|
20
|
+
> but unfortunately also insufficient to continue.
|
|
21
|
+
> We need to cover security triage, CVE handling, fixes, and releases.
|
|
22
|
+
> Progress toward that goal will be posted here.
|
|
23
|
+
>
|
|
24
|
+
> **If your company depends on follow-redirects,**
|
|
25
|
+
> directly or another library,
|
|
26
|
+
> please [sponsor on GitHub](https://github.com/sponsors/RubenVerborgh)
|
|
27
|
+
> or email us for invoice-based funding or a security support agreement.
|
|
2
28
|
|
|
3
29
|
Drop-in replacement for Node's `http` and `https` modules that automatically follows redirects.
|
|
4
30
|
|
|
@@ -302,7 +302,16 @@ RedirectableRequest.prototype._sanitizeOptions = function (options) {
|
|
|
302
302
|
if (!options.headers) {
|
|
303
303
|
options.headers = {};
|
|
304
304
|
}
|
|
305
|
-
|
|
305
|
+
// Convert [header1, value1, header2, value2, …] to object
|
|
306
|
+
else if (Array.isArray(options.headers)) {
|
|
307
|
+
var headerList = options.headers;
|
|
308
|
+
options.headers = {};
|
|
309
|
+
for (var i = 0; i < headerList.length; i += 2) {
|
|
310
|
+
options.headers[headerList[i]] = headerList[i + 1];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
// Ensure sensitive headers are always present
|
|
314
|
+
if (!Array.isArray(options.sensitiveHeaders)) {
|
|
306
315
|
options.sensitiveHeaders = [];
|
|
307
316
|
}
|
|
308
317
|
|
|
@@ -680,10 +689,6 @@ function isSubdomain(subdomain, domain) {
|
|
|
680
689
|
return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
|
|
681
690
|
}
|
|
682
691
|
|
|
683
|
-
function isArray(value) {
|
|
684
|
-
return value instanceof Array;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
692
|
function isString(value) {
|
|
688
693
|
return typeof value === "string" || value instanceof String;
|
|
689
694
|
}
|
|
@@ -701,7 +706,7 @@ function isURL(value) {
|
|
|
701
706
|
}
|
|
702
707
|
|
|
703
708
|
function escapeRegex(regex) {
|
|
704
|
-
return regex.replace(/[\]\\/()
|
|
709
|
+
return regex.replace(/[[\]\\/()*+?.^$|]/g, "\\$&");
|
|
705
710
|
}
|
|
706
711
|
|
|
707
712
|
// Exports
|
|
@@ -10,7 +10,8 @@ const emptyDir = u(async function emptyDir (dir) {
|
|
|
10
10
|
let items
|
|
11
11
|
try {
|
|
12
12
|
items = await fs.readdir(dir)
|
|
13
|
-
} catch {
|
|
13
|
+
} catch (err) {
|
|
14
|
+
if (err.code !== 'ENOENT') throw err
|
|
14
15
|
return mkdir.mkdirs(dir)
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -21,7 +22,8 @@ function emptyDirSync (dir) {
|
|
|
21
22
|
let items
|
|
22
23
|
try {
|
|
23
24
|
items = fs.readdirSync(dir)
|
|
24
|
-
} catch {
|
|
25
|
+
} catch (err) {
|
|
26
|
+
if (err.code !== 'ENOENT') throw err
|
|
25
27
|
return mkdir.mkdirsSync(dir)
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -40,7 +40,7 @@ async function checkPaths (src, dest, funcName, opts) {
|
|
|
40
40
|
const destBaseName = path.basename(dest)
|
|
41
41
|
if (funcName === 'move' &&
|
|
42
42
|
srcBaseName !== destBaseName &&
|
|
43
|
-
srcBaseName
|
|
43
|
+
isCosmeticRename(srcBaseName, destBaseName)) {
|
|
44
44
|
return { srcStat, destStat, isChangingCase: true }
|
|
45
45
|
}
|
|
46
46
|
throw new Error('Source and destination must not be the same.')
|
|
@@ -69,7 +69,7 @@ function checkPathsSync (src, dest, funcName, opts) {
|
|
|
69
69
|
const destBaseName = path.basename(dest)
|
|
70
70
|
if (funcName === 'move' &&
|
|
71
71
|
srcBaseName !== destBaseName &&
|
|
72
|
-
srcBaseName
|
|
72
|
+
isCosmeticRename(srcBaseName, destBaseName)) {
|
|
73
73
|
return { srcStat, destStat, isChangingCase: true }
|
|
74
74
|
}
|
|
75
75
|
throw new Error('Source and destination must not be the same.')
|
|
@@ -88,6 +88,16 @@ function checkPathsSync (src, dest, funcName, opts) {
|
|
|
88
88
|
return { srcStat, destStat }
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
// True when src and dest refer to the same inode and their basenames only
|
|
92
|
+
// differ in letter case or Unicode normalization form. Some filesystems
|
|
93
|
+
// (APFS, most Windows filesystems) silently normalize case and/or Unicode
|
|
94
|
+
// representation, so a rename that looks like a no-op string-wise is
|
|
95
|
+
// actually the user renaming a file to a visually-identical but
|
|
96
|
+
// differently-encoded name, not a genuine "same path" error.
|
|
97
|
+
function isCosmeticRename (srcBaseName, destBaseName) {
|
|
98
|
+
return srcBaseName.toLowerCase().normalize('NFC') === destBaseName.toLowerCase().normalize('NFC')
|
|
99
|
+
}
|
|
100
|
+
|
|
91
101
|
// recursively check if dest parent is a subdirectory of src.
|
|
92
102
|
// It works for all file types including symlinks since it
|
|
93
103
|
// checks the src and dest inodes. It starts from the deepest
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Feross Aboukhadijeh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|