From 828a2a73c9302bde131be9f9cc3b99e14d6214c8 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sun, 21 Apr 2019 02:38:02 +0900 Subject: [PATCH] =?UTF-8?q?Fix=20=E6=8A=95=E7=A8=BF=E5=A2=97=E6=AE=96=20fo?= =?UTF-8?q?r=20v10=20(#4758)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix #4632 * remove unused import --- src/server/api/endpoints/ap/show.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/server/api/endpoints/ap/show.ts b/src/server/api/endpoints/ap/show.ts index a7c9e55d4..f3fa9d2e7 100644 --- a/src/server/api/endpoints/ap/show.ts +++ b/src/server/api/endpoints/ap/show.ts @@ -86,6 +86,17 @@ async function fetchAny(uri: string) { // /@user のような正規id以外で取得できるURIが指定されていた場合、ここで初めて正規URIが確定する // これはDBに存在する可能性があるため再度DB検索 if (uri !== object.id) { + if (object.id.startsWith(config.url + '/')) { + const id = new mongo.ObjectID(object.id.split('/').pop()); + const [user, note] = await Promise.all([ + User.findOne({ _id: id }), + Note.findOne({ _id: id }) + ]); + + const packed = await mergePack(user, note); + if (packed !== null) return packed; + } + const [user, note] = await Promise.all([ User.findOne({ uri: object.id }), Note.findOne({ uri: object.id })