fix(core): update
This commit is contained in:
parent
8d9c75e113
commit
a1ee8f37d6
@ -69,5 +69,13 @@ export const isUtf8 = (stringArg: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const isBase64 = (stringArg: string) => {
|
export const isBase64 = (stringArg: string) => {
|
||||||
return stringArg.endsWith('=');
|
const notBase64 = /[^A-Z0-9+\/=]/i;
|
||||||
|
const len = stringArg.length;
|
||||||
|
if (!len || len % 4 !== 0 || notBase64.test(stringArg)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const firstPaddingChar = stringArg.indexOf('=');
|
||||||
|
return firstPaddingChar === -1 ||
|
||||||
|
firstPaddingChar === len - 1 ||
|
||||||
|
(firstPaddingChar === len - 2 && stringArg[len - 1] === '=');
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user