From fd87a63e573581544a169143fad4ef2180be22bd Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 5 Apr 2018 18:50:52 +0900 Subject: [PATCH] wip --- src/remote/activitypub/resolve-person.ts | 2 +- src/remote/resolve-user.ts | 2 +- src/server/api/endpoints/users/show.ts | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/remote/activitypub/resolve-person.ts b/src/remote/activitypub/resolve-person.ts index c288a2f009..b979bb1cd2 100644 --- a/src/remote/activitypub/resolve-person.ts +++ b/src/remote/activitypub/resolve-person.ts @@ -15,7 +15,7 @@ export default async (value, verifier?: string) => { object.type !== 'Person' || typeof object.preferredUsername !== 'string' || !validateUsername(object.preferredUsername) || - !isValidName(object.name) || + (object.name != '' && !isValidName(object.name)) || !isValidDescription(object.summary) ) { throw new Error('invalid person'); diff --git a/src/remote/resolve-user.ts b/src/remote/resolve-user.ts index 48219e8cb3..9e1ae51952 100644 --- a/src/remote/resolve-user.ts +++ b/src/remote/resolve-user.ts @@ -16,7 +16,7 @@ export default async (username, host, option) => { const finger = await webFinger(acctLower, acctLower); const self = finger.links.find(link => link.rel && link.rel.toLowerCase() === 'self'); if (!self) { - throw new Error(); + throw new Error('self link not found'); } user = await resolvePerson(self.href, acctLower); diff --git a/src/server/api/endpoints/users/show.ts b/src/server/api/endpoints/users/show.ts index 2b02799378..d272ce4639 100644 --- a/src/server/api/endpoints/users/show.ts +++ b/src/server/api/endpoints/users/show.ts @@ -37,7 +37,8 @@ module.exports = (params, me) => new Promise(async (res, rej) => { if (typeof host === 'string') { try { user = await resolveRemoteUser(username, host, cursorOption); - } catch (exception) { + } catch (e) { + console.warn(`failed to resolve remote user: ${e}`); return rej('failed to resolve remote user'); } } else {