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?; }