Skip to content

Commit

Permalink
Fix OperationError when strict mode is enabled and text is not padded
Browse files Browse the repository at this point in the history
  • Loading branch information
pandaninjas authored Nov 20, 2023
1 parent 6ed9d45 commit 7e6813c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/lib/Base64.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export function fromBase64(data, alphabet="A-Za-z0-9+/=", returnType="string", r
enc3 = alphabet.indexOf(data.charAt(i++) || null);
enc4 = alphabet.indexOf(data.charAt(i++) || null);

if (strictMode && (enc1 < 0 || enc2 < 0 || enc3 < 0 || enc4 < 0)) {
if (strictMode && (enc1 < 0 || enc2 < 0 || (enc3 < 0 && data.charAt(i - 2) !== '') ||(enc4 < 0 && data.charAt(i - 1) !== ''))) {

Check failure on line 139 in src/core/lib/Base64.mjs

View workflow job for this annotation

GitHub Actions / main

Strings must use doublequote

Check failure on line 139 in src/core/lib/Base64.mjs

View workflow job for this annotation

GitHub Actions / main

Strings must use doublequote
throw new OperationError("Error: Base64 input contains non-alphabet char(s)");
}

Expand Down

0 comments on commit 7e6813c

Please sign in to comment.