From a3fa22b5eb12a5ba9acb8ab87edead4b79ad9dfc Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 2 Apr 2021 23:16:10 +0800 Subject: fix: Fix base64 bug for unicode string. --- FrontEnd/src/app/http/common.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'FrontEnd/src') diff --git a/FrontEnd/src/app/http/common.ts b/FrontEnd/src/app/http/common.ts index 5006109d..78ba3cda 100644 --- a/FrontEnd/src/app/http/common.ts +++ b/FrontEnd/src/app/http/common.ts @@ -1,4 +1,5 @@ import rawAxios, { AxiosError, AxiosResponse } from "axios"; +import { Base64 } from "js-base64"; export const apiBaseUrl = "/api"; @@ -63,7 +64,7 @@ export function setHttpToken(token: string | null): void { export function base64(blob: Blob | string): Promise { if (typeof blob === "string") { - return Promise.resolve(btoa(blob)); + return Promise.resolve(Base64.encode(blob)); } return new Promise((resolve) => { -- cgit v1.2.3