Skip to content

Commit 701c42e

Browse files
authored
Merge pull request #52 from vonernue/patch-1
fix(client/uploadObjTalk): allow unicode filename
2 parents 45e40c5 + 7203bd6 commit 701c42e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/linejs/client/clients/base-client.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,7 @@ export class BaseClient extends TypedEventEmitter<ClientEvents> {
16291629
}
16301630
const body = await response.arrayBuffer();
16311631
const parsedBody = new Uint8Array(body);
1632-
1632+
16331633
// patch empty response
16341634
if (Object.keys(parsedBody).length === 0) {
16351635
return { value: null, e: null, _info: null };
@@ -2014,6 +2014,9 @@ export class BaseClient extends TypedEventEmitter<ClientEvents> {
20142014
}
20152015
const toType: "talk" | "g2" =
20162016
to[0] === "m" || to[0] === "t" ? "g2" : "talk";
2017+
const encodedParams = btoa(
2018+
String.fromCharCode(...new TextEncoder().encode(JSON.stringify(param))),
2019+
);
20172020
return this.customFetch(
20182021
this.LINE_OBS.prefix + "r/" + toType + "/m/reqseq",
20192022
{
@@ -2022,7 +2025,7 @@ export class BaseClient extends TypedEventEmitter<ClientEvents> {
20222025
"x-line-application": this.system?.type as string,
20232026
"x-Line-access": this.metadata.authToken,
20242027
"content-type": "application/x-www-form-urlencoded",
2025-
"x-obs-params": btoa(JSON.stringify(param)),
2028+
"x-obs-params": encodedParams,
20262029
},
20272030
body: data,
20282031
method: "POST",

0 commit comments

Comments
 (0)