We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91f0f7b commit bae383fCopy full SHA for bae383f
1 file changed
base64.js
@@ -81,7 +81,10 @@ if (Uint8Array.fromBase64) {
81
for (let i = 0; i < raw.length; i++) arr[i] = raw.charCodeAt(i)
82
} else {
83
// base64url is already checked to have no padding via a regex above
84
- if (!isBase64url) assert(!str.includes('=') || !/=[^=]/iu.test(str), 'Invalid padding')
+ if (!isBase64url) {
85
+ const at = str.indexOf('=')
86
+ if (at >= 0) assert(!/[^=]/iu.test(str.slice(at)), 'Invalid padding')
87
+ }
88
arr = haveNativeBuffer ? Buffer.from(str, 'base64') : fromBase64js(str)
89
}
90
0 commit comments