mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
Mobile: Upgrade slug package to fix btoa bug
This commit is contained in:
parent
f276d2b2d4
commit
433fa21069
6
CliClient/package-lock.json
generated
6
CliClient/package-lock.json
generated
@ -5881,9 +5881,9 @@
|
||||
}
|
||||
},
|
||||
"slug": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/slug/-/slug-3.3.4.tgz",
|
||||
"integrity": "sha512-VpHbtRCEWmgaZsrZcTsVl/Dhw98lcrOYDO17DNmJCNpppI6s3qJvnNu2Q3D4L84/2bi6vkW40mjNQI9oGQsflg=="
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/slug/-/slug-3.5.0.tgz",
|
||||
"integrity": "sha512-+pZLDhMtmAc+ZcojQSMlUKDZBYmvhZiZmK8Ffx/D3Q/MIMHPDBAMbWvWN8vJb9xl2MfbDdRWxFzrdOhBiyVpow=="
|
||||
},
|
||||
"snapdragon": {
|
||||
"version": "0.8.2",
|
||||
|
@ -98,6 +98,7 @@
|
||||
"sax": "^1.2.4",
|
||||
"server-destroy": "^1.0.1",
|
||||
"sharp": "^0.23.2",
|
||||
"slug": "^3.5.0",
|
||||
"sprintf-js": "^1.1.1",
|
||||
"sqlite3": "^4.1.1",
|
||||
"string-padding": "^1.0.2",
|
||||
@ -109,7 +110,6 @@
|
||||
"terminal-kit": "^1.30.0",
|
||||
"tkwidgets": "^0.5.26",
|
||||
"url-parse": "^1.4.7",
|
||||
"slug": "^3.3.4",
|
||||
"uuid": "^3.0.1",
|
||||
"valid-url": "^1.0.9",
|
||||
"word-wrap": "^1.2.3",
|
||||
|
6
ElectronClient/package-lock.json
generated
6
ElectronClient/package-lock.json
generated
@ -10670,9 +10670,9 @@
|
||||
}
|
||||
},
|
||||
"slug": {
|
||||
"version": "3.3.4",
|
||||
"resolved": "https://registry.npmjs.org/slug/-/slug-3.3.4.tgz",
|
||||
"integrity": "sha512-VpHbtRCEWmgaZsrZcTsVl/Dhw98lcrOYDO17DNmJCNpppI6s3qJvnNu2Q3D4L84/2bi6vkW40mjNQI9oGQsflg=="
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/slug/-/slug-3.5.0.tgz",
|
||||
"integrity": "sha512-+pZLDhMtmAc+ZcojQSMlUKDZBYmvhZiZmK8Ffx/D3Q/MIMHPDBAMbWvWN8vJb9xl2MfbDdRWxFzrdOhBiyVpow=="
|
||||
},
|
||||
"smalltalk": {
|
||||
"version": "2.5.1",
|
||||
|
@ -193,7 +193,7 @@
|
||||
"roboto-fontface": "^0.10.0",
|
||||
"sax": "^1.2.4",
|
||||
"server-destroy": "^1.0.1",
|
||||
"slug": "^3.3.4",
|
||||
"slug": "^3.5.0",
|
||||
"smalltalk": "^2.5.1",
|
||||
"sprintf-js": "^1.1.1",
|
||||
"sqlite3": "^4.1.1",
|
||||
|
@ -38,6 +38,6 @@
|
||||
"md5": "^2.2.1",
|
||||
"memory-cache": "^0.2.0",
|
||||
"mermaid": "^8.8.0",
|
||||
"slug": "^3.3.4"
|
||||
"slug": "^3.5.0"
|
||||
}
|
||||
}
|
||||
|
7
ReactNativeClient/package-lock.json
generated
7
ReactNativeClient/package-lock.json
generated
@ -4881,6 +4881,7 @@
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
@ -9992,9 +9993,9 @@
|
||||
"integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc="
|
||||
},
|
||||
"slug": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/slug/-/slug-3.4.0.tgz",
|
||||
"integrity": "sha512-s234DYtuRCkzVNL8dL9BRFNmlZUF9NUGjxWG+wwBKPzUFUADrhkjKGVNhDaZs2Lc+UKh3085KItaKilwJA9I2Q=="
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/slug/-/slug-3.5.0.tgz",
|
||||
"integrity": "sha512-+pZLDhMtmAc+ZcojQSMlUKDZBYmvhZiZmK8Ffx/D3Q/MIMHPDBAMbWvWN8vJb9xl2MfbDdRWxFzrdOhBiyVpow=="
|
||||
},
|
||||
"slugify": {
|
||||
"version": "1.3.6",
|
||||
|
@ -83,7 +83,7 @@
|
||||
"redux": "4.0.0",
|
||||
"reselect": "^4.0.0",
|
||||
"rn-fetch-blob": "^0.12.0",
|
||||
"slug": "^3.4.0",
|
||||
"slug": "^3.5.0",
|
||||
"stream": "0.0.2",
|
||||
"string-natural-compare": "^2.0.2",
|
||||
"string-padding": "^1.0.2",
|
||||
|
@ -1,38 +0,0 @@
|
||||
diff --git a/node_modules/slug/slug.js b/node_modules/slug/slug.js
|
||||
index b40320b..2be9650 100644
|
||||
--- a/node_modules/slug/slug.js
|
||||
+++ b/node_modules/slug/slug.js
|
||||
@@ -51,13 +51,31 @@
|
||||
throw new Error('String "' + str + '" reaches code believed to be unreachable; please open an issue at https://github.com/Trott/slug/issues/new')
|
||||
}
|
||||
|
||||
- if (typeof window === 'undefined') {
|
||||
+ if (typeof window !== 'undefined' && window.btoa) {
|
||||
+ base64 = function (input) {
|
||||
+ return btoa(unescape(encodeURIComponent(input)))
|
||||
+ }
|
||||
+ } else if (typeof Buffer !== 'undefined') {
|
||||
base64 = function (input) {
|
||||
return Buffer.from(input).toString('base64')
|
||||
}
|
||||
} else {
|
||||
+ // Polyfill for environments that don't have any btoa or Buffer class (eg. React Native)
|
||||
+ // Copied from https://github.com/davidchambers/Base64.js/blob/a121f75bb10c8dd5d557886c4b1069b31258d230/base64.js#L22
|
||||
base64 = function (input) {
|
||||
- return btoa(unescape(encodeURIComponent(input)))
|
||||
+ var str = unescape(encodeURIComponent(input + ''))
|
||||
+ for (
|
||||
+ var block, charCode, idx = 0, map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', output = '';
|
||||
+ str.charAt(idx | 0) || (map = '=', idx % 1);
|
||||
+ output += map.charAt(63 & block >> 8 - idx % 1 * 8)
|
||||
+ ) {
|
||||
+ charCode = str.charCodeAt(idx += 3 / 4)
|
||||
+ if (charCode > 0xFF) {
|
||||
+ throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.")
|
||||
+ }
|
||||
+ block = block << 8 | charCode
|
||||
+ }
|
||||
+ return output
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user