Skip to content

Commit

Permalink
Merge pull request #52 from vonernue/patch-1
Browse files Browse the repository at this point in the history
fix(client/uploadObjTalk): allow unicode filename
  • Loading branch information
EdamAme-x authored Dec 26, 2024
2 parents 45e40c5 + 7203bd6 commit 701c42e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/linejs/client/clients/base-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ export class BaseClient extends TypedEventEmitter<ClientEvents> {
}
const body = await response.arrayBuffer();
const parsedBody = new Uint8Array(body);

// patch empty response
if (Object.keys(parsedBody).length === 0) {
return { value: null, e: null, _info: null };
Expand Down Expand Up @@ -2014,6 +2014,9 @@ export class BaseClient extends TypedEventEmitter<ClientEvents> {
}
const toType: "talk" | "g2" =
to[0] === "m" || to[0] === "t" ? "g2" : "talk";
const encodedParams = btoa(
String.fromCharCode(...new TextEncoder().encode(JSON.stringify(param))),
);
return this.customFetch(
this.LINE_OBS.prefix + "r/" + toType + "/m/reqseq",
{
Expand All @@ -2022,7 +2025,7 @@ export class BaseClient extends TypedEventEmitter<ClientEvents> {
"x-line-application": this.system?.type as string,
"x-Line-access": this.metadata.authToken,
"content-type": "application/x-www-form-urlencoded",
"x-obs-params": btoa(JSON.stringify(param)),
"x-obs-params": encodedParams,
},
body: data,
method: "POST",
Expand Down

0 comments on commit 701c42e

Please sign in to comment.