From 854fd95a4d8cf2d8057074157174498d58e3574a Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 3 May 2024 06:23:28 +0200 Subject: [PATCH] fix: correctly reconstruct urls for users too --- src/routes/activitypub/object/mod.rs | 6 +----- src/routes/activitypub/user/mod.rs | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/routes/activitypub/object/mod.rs b/src/routes/activitypub/object/mod.rs index 17c2e6ce..8ad7ab7d 100644 --- a/src/routes/activitypub/object/mod.rs +++ b/src/routes/activitypub/object/mod.rs @@ -14,11 +14,7 @@ pub async fn view( AuthIdentity(auth): AuthIdentity, Query(query): Query, ) -> crate::Result> { - let oid = if id.starts_with('+') { - format!("https://{}", id.replacen('+', "", 1).replace('@', "/")) - } else { - ctx.oid(id.clone()) - }; + let oid = ctx.uri("objects", id); if auth.is_local() && query.fetch && !ctx.is_local(&oid) { let obj = ctx.fetch_object(&oid).await?; // some implementations serve statuses on different urls than their AP id diff --git a/src/routes/activitypub/user/mod.rs b/src/routes/activitypub/user/mod.rs index aa7b4ab7..1c94c69d 100644 --- a/src/routes/activitypub/user/mod.rs +++ b/src/routes/activitypub/user/mod.rs @@ -19,11 +19,7 @@ pub async fn view( Path(id): Path, Query(query): Query, ) -> crate::Result> { - let uid = if id.starts_with('+') { - format!("https://{}", id.replacen('+', "", 1).replace('@', "/")) - } else { - ctx.uid(id.clone()) - }; + let uid = ctx.uri("users", id.clone()); if auth.is_local() && query.fetch && !ctx.is_local(&uid) { ctx.fetch_user(&uid).await?; }