From 0ef31a8bace77ccff5e3f3a4588069893f99f0bb Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 20 Sep 2019 05:14:21 +0900 Subject: [PATCH] Fix: unknown user cause 500 on AP (#5436) --- src/server/activitypub.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/activitypub.ts b/src/server/activitypub.ts index cd9ac752a..1803fef79 100644 --- a/src/server/activitypub.ts +++ b/src/server/activitypub.ts @@ -146,7 +146,7 @@ router.get('/users/:user/publickey', async ctx => { }); // user -async function userInfo(ctx: Router.IRouterContext, user: User) { +async function userInfo(ctx: Router.IRouterContext, user: User | undefined) { if (user == null) { ctx.status = 404; return; @@ -165,7 +165,7 @@ router.get('/users/:user', async (ctx, next) => { const user = await Users.findOne({ id: userId, host: null - }).then(ensure); + }); await userInfo(ctx, user); }); @@ -176,7 +176,7 @@ router.get('/@:user', async (ctx, next) => { const user = await Users.findOne({ usernameLower: ctx.params.user.toLowerCase(), host: null - }).then(ensure); + }); await userInfo(ctx, user); });