diff --git a/packages/core/src/bot.ts b/packages/core/src/bot.ts index dfef71b7..6da49832 100644 --- a/packages/core/src/bot.ts +++ b/packages/core/src/bot.ts @@ -213,7 +213,7 @@ export abstract class Bot { const headers = new Headers() headers.set('content-type', upload.type) if (upload.filename) { - headers.set('content-disposition', `attachment; filename="${upload.filename}"`) + headers.set('content-disposition', `attachment; filename*=UTF-8''${encodeURIComponent(upload.filename)}`) } this.ctx.satori._tempStore[id] = { status: 200, diff --git a/packages/core/src/session.ts b/packages/core/src/session.ts index 5dd52d45..1121b916 100644 --- a/packages/core/src/session.ts +++ b/packages/core/src/session.ts @@ -1,4 +1,4 @@ -import { Channel, Event, GuildMember, Login, Message, Resource, User } from '@satorijs/protocol' +import { Channel, Event, GuildMember, Message, Resource, User } from '@satorijs/protocol' import { clone, defineProperty, isNullable } from 'cosmokit' import { Context, Service } from 'cordis' import { Bot } from './bot' @@ -137,12 +137,9 @@ export class Session { toJSON() { const event: Event = { - login: { - platform: this.platform, - user: { id: this.selfId }, - } as Login, ...clone(this.event), sn: this.sn, + login: this.bot.toJSON(), ['id' as never]: this.sn, // for backward compatibility } if (event.message?.elements) {