axios 0.30.1 → 0.30.3

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.
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
5
+ * - For base64: compute exact decoded size using length and padding;
6
+ * handle %XX at the character-count level (no string allocation).
7
+ * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
8
+ *
9
+ * @param {string} url
10
+ * @returns {number}
11
+ */
12
+ function estimateDataURLDecodedBytes(url) {
13
+ if (!url || typeof url !== 'string') return 0;
14
+ if (!url.startsWith('data:')) return 0;
15
+
16
+ var comma = url.indexOf(',');
17
+ if (comma < 0) return 0;
18
+
19
+ var meta = url.slice(5, comma);
20
+ var body = url.slice(comma + 1);
21
+ var isBase64 = /;base64/i.test(meta);
22
+
23
+ if (isBase64) {
24
+ var effectiveLen = body.length;
25
+ var len = body.length; // cache length
26
+
27
+ for (var i = 0; i < len; i++) {
28
+ if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
29
+ var a = body.charCodeAt(i + 1);
30
+ var b = body.charCodeAt(i + 2);
31
+ var isHex =
32
+ ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
33
+ ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
34
+
35
+ if (isHex) {
36
+ effectiveLen -= 2;
37
+ i += 2;
38
+ }
39
+ }
40
+ }
41
+
42
+ var pad = 0;
43
+ var idx = len - 1;
44
+
45
+ // eslint-disable-next-line no-inner-declarations
46
+ function tailIsPct3D(j) {
47
+ return j >= 2 &&
48
+ body.charCodeAt(j - 2) === 37 && // '%'
49
+ body.charCodeAt(j - 1) === 51 && // '3'
50
+ (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
51
+ }
52
+
53
+ if (idx >= 0) {
54
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
55
+ pad++;
56
+ idx--;
57
+ } else if (tailIsPct3D(idx)) {
58
+ pad++;
59
+ idx -= 3;
60
+ }
61
+ }
62
+
63
+ if (pad === 1 && idx >= 0) {
64
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
65
+ pad++;
66
+ } else if (tailIsPct3D(idx)) {
67
+ pad++;
68
+ }
69
+ }
70
+
71
+ var groups = Math.floor(effectiveLen / 4);
72
+ var bytes = groups * 3 - (pad || 0);
73
+ return bytes > 0 ? bytes : 0;
74
+ }
75
+
76
+ return Buffer.byteLength(body, 'utf8');
77
+ }
78
+
79
+ module.exports = estimateDataURLDecodedBytes;
package/lib/utils.js CHANGED
@@ -310,6 +310,10 @@ function forEach(obj, fn) {
310
310
  function merge(/* obj1, obj2, obj3, ... */) {
311
311
  var result = {};
312
312
  function assignValue(val, key) {
313
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
314
+ return;
315
+ }
316
+
313
317
  if (isPlainObject(result[key]) && isPlainObject(val)) {
314
318
  result[key] = merge(result[key], val);
315
319
  } else if (isPlainObject(val)) {
package/mise.toml ADDED
@@ -0,0 +1,2 @@
1
+ [tools]
2
+ node = "20"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "0.30.1",
3
+ "version": "0.30.3",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+https://github.com/axios/axios.git"
18
+ "url": "https://github.com/axios/axios.git"
19
19
  },
20
20
  "keywords": [
21
21
  "xhr",
@@ -40,7 +40,7 @@
40
40
  "body-parser": "^1.20.0",
41
41
  "coveralls": "^3.1.1",
42
42
  "cross-env": "^7.0.3",
43
- "dtslint": "^4.2.1",
43
+ "dtslint": "4.2.1",
44
44
  "es6-promise": "^4.2.8",
45
45
  "express": "^4.18.1",
46
46
  "formidable": "^2.0.1",