From e8e4bafa6410fce77ec70efceec842926c666cfa Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 30 Oct 2023 00:34:19 +0100 Subject: [PATCH] upd: remove host lookup on file updating --- .../src/server/api/mastodon/MastodonApiServerService.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts index a956cf903..06aaebf03 100644 --- a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts +++ b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts @@ -261,9 +261,8 @@ export class MastodonApiServerService { console.error(tokeninfo); if (tokeninfo && (_request.files as any)['avatar']) { const file = toSingleLast((_request.files as any)['avatar']); - const user = await this.usersRepository.findOneBy({ id: tokeninfo.userId }); const upload = await this.driveService.addFile({ - user: { id: tokeninfo.userId, host: user ? user.host : null }, + user: { id: tokeninfo.userId, host: null }, path: file.path, name: file.originalname !== null && file.originalname !== 'file' ? file.originalname : undefined, sensitive: false, @@ -274,9 +273,8 @@ export class MastodonApiServerService { } if (tokeninfo && (_request.files as any)['header']) { const file = toSingleLast((_request.files as any)['header']); - const user = await this.usersRepository.findOneBy({ id: tokeninfo.userId }); const upload = await this.driveService.addFile({ - user: { id: tokeninfo.userId, host: user ? user.host : null }, + user: { id: tokeninfo.userId, host: null }, path: file.path, name: file.originalname !== null && file.originalname !== 'file' ? file.originalname : undefined, sensitive: false,