From 2aa7c1ae34d2942a5a338510777a5a7e082b2a24 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 30 Oct 2023 00:29:58 +0100 Subject: [PATCH] upd: remove Bearer from auth when looking up token --- .../src/server/api/mastodon/MastodonApiServerService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts index 0bfa1a39fa..a956cf9036 100644 --- a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts +++ b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts @@ -256,8 +256,8 @@ export class MastodonApiServerService { const client = getClient(BASE_URL, accessTokens); // we are using this here, because in private mode some info isnt // displayed without being logged in try { - if (_request.files.length > 0) { - const tokeninfo = await this.accessTokensRepository.findOneBy({ token: accessTokens }); + if (_request.files.length > 0 && accessTokens) { + const tokeninfo = await this.accessTokensRepository.findOneBy({ token: accessTokens.replace('Bearer ', '') }); console.error(tokeninfo); if (tokeninfo && (_request.files as any)['avatar']) { const file = toSingleLast((_request.files as any)['avatar']);