Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: userInfo name conversion encoding format (#755)

DiamondThreed7e3d524e5a4
diff --git a/packages/data-center/src/provider/affine/apis/token.ts b/packages/data-center/src/provider/affine/apis/token.ts
index 88c1997772..f002fedb9e 100644
--- a/packages/data-center/src/provider/affine/apis/token.ts
+++ b/packages/data-center/src/provider/affine/apis/token.ts
@@ -100,17 +100,13 @@ class Token {
static parse(token: string): AccessTokenMessage | null {
try {
return JSON.parse(
- String.fromCharCode.apply(
- null,
- Array.from(
- Uint8Array.from(
- window.atob(
- // split jwt
- token.split('.')[1]
- ),
- c => c.charCodeAt(0)
- )
- )
+ decodeURIComponent(
+ atob(token.split('.')[1])
+ .split('')
+ .map(function (c) {
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
+ })
+ .join('')
)
);
} catch (error) {