diff --git a/base64/decode/decode.node.ts b/base64/decode/decode.node.ts index 36112b9becb..47c3674dc45 100644 --- a/base64/decode/decode.node.ts +++ b/base64/decode/decode.node.ts @@ -1,5 +1,8 @@ namespace $ { export function $mol_base64_decode_node(base64Str: string): Uint8Array { + + base64Str = base64Str.replace( /-/g, '+' ).replace( /_/g, '/' ) + // without Uint8Array breaks $mol_compare_deep const buffer = Buffer.from(base64Str, 'base64') diff --git a/base64/decode/decode.web.ts b/base64/decode/decode.web.ts index 30d5f9baf11..9bacc15a7c8 100644 --- a/base64/decode/decode.web.ts +++ b/base64/decode/decode.web.ts @@ -1,6 +1,7 @@ namespace $ { export function $mol_base64_decode_web(base64Str: string): Uint8Array { + base64Str = base64Str.replace( /-/g, '+' ).replace( /_/g, '/' ) return new Uint8Array($mol_dom_context.atob(base64Str).split('').map(c => c.charCodeAt(0))) }