From 39705a1796c80c31d9ae0189985f89434900bb44 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 30 Dec 2024 14:53:56 -0500 Subject: [PATCH] fix: #13017, probe redirection if url is identical to id --- src/activitypub/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/activitypub/index.js b/src/activitypub/index.js index b54dc83be6..8a254a78f4 100644 --- a/src/activitypub/index.js +++ b/src/activitypub/index.js @@ -460,9 +460,10 @@ ActivityPub.probe = async ({ uid, url }) => { */ // Known resources - const [isNote, isMessage, isActor] = await Promise.all([ + const [isNote, isMessage, isActor, isActorUrl] = await Promise.all([ posts.exists(url), messaging.messageExists(url), + db.isSortedSetMember('usersRemote:lastCrawled', url), // if url is same as id db.isObjectField('remoteUrl:uid', url), ]); switch (true) { @@ -482,6 +483,11 @@ ActivityPub.probe = async ({ uid, url }) => { } case isActor: { + const slug = await user.getUserField(url, 'userslug'); + return `/user/${slug}`; + } + + case isActorUrl: { const uid = await db.getObjectField('remoteUrl:uid', url); const slug = await user.getUserField(uid, 'userslug'); return `/user/${slug}`;