fix base64 preprocessing
This commit is contained in:
@@ -207,11 +207,11 @@ export function base64DecodedLen(n) {
|
|||||||
// The string may be base64-URL encoded without the padding.
|
// The string may be base64-URL encoded without the padding.
|
||||||
export function base64ReEncode(str) {
|
export function base64ReEncode(str) {
|
||||||
if (str) {
|
if (str) {
|
||||||
str = str.replace('-', '+').replace('_', '/');
|
str = str.replace(/-/g, '+').replace(/_/g, '/');
|
||||||
try {
|
try {
|
||||||
str = btoa(atob(str));
|
str = btoa(atob(str));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.log("Failed to base64 re-encode string");
|
console.log("Failed to base64 re-encode string.", err);
|
||||||
str = null;
|
str = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user