diff options
author | alemi <me@alemi.dev> | 2024-05-03 06:23:28 +0200 |
---|---|---|
committer | alemi <me@alemi.dev> | 2024-05-03 06:23:28 +0200 |
commit | 854fd95a4d8cf2d8057074157174498d58e3574a (patch) | |
tree | 0a03d832b6adb6383a3ca4c60abea14e360ea259 | |
parent | 6cb45bd5f04c2679c0caf4fa05dc2beb4461ecc3 (diff) |
fix: correctly reconstruct urls for users too
-rw-r--r-- | src/routes/activitypub/object/mod.rs | 6 | ||||
-rw-r--r-- | 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 17c2e6c..8ad7ab7 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<TryFetch>, ) -> crate::Result<JsonLD<serde_json::Value>> { - 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 aa7b4ab..1c94c69 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<String>, Query(query): Query<TryFetch>, ) -> crate::Result<JsonLD<serde_json::Value>> { - 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?; } |