Skip to content

Commit

Permalink
fix borked base64 url-save
Browse files Browse the repository at this point in the history
  • Loading branch information
gandlafbtc committed Jul 4, 2024
1 parent 1602181 commit c251e26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/base64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ function encodeBase64ToJson<T extends object>(base64String: string): T {
}

function base64urlToBase64(str: string) {
return str.replace(/-/g, '+').replace(/_/g, '/').replace(/./g, '=');
return str.replace(/-/g, '+').replace(/_/g, '/').split('=')[0]
// .replace(/./g, '=');
}

function base64urlFromBase64(str: string) {
return str.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '.');
return str.replace(/\+/g, '-').replace(/\//g, '_').split('=')[0]
// .replace(/=/g, '.');
}

export { encodeUint8toBase64, encodeBase64toUint8, encodeJsonToBase64, encodeBase64ToJson };

0 comments on commit c251e26

Please sign in to comment.