fix: correctly reconstruct urls for users too

This commit is contained in:
əlemi 2024-05-03 06:23:28 +02:00
parent 6cb45bd5f0
commit 854fd95a4d
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 2 additions and 10 deletions

View file

@ -14,11 +14,7 @@ pub async fn view(
AuthIdentity(auth): AuthIdentity, AuthIdentity(auth): AuthIdentity,
Query(query): Query<TryFetch>, Query(query): Query<TryFetch>,
) -> crate::Result<JsonLD<serde_json::Value>> { ) -> crate::Result<JsonLD<serde_json::Value>> {
let oid = if id.starts_with('+') { let oid = ctx.uri("objects", id);
format!("https://{}", id.replacen('+', "", 1).replace('@', "/"))
} else {
ctx.oid(id.clone())
};
if auth.is_local() && query.fetch && !ctx.is_local(&oid) { if auth.is_local() && query.fetch && !ctx.is_local(&oid) {
let obj = ctx.fetch_object(&oid).await?; let obj = ctx.fetch_object(&oid).await?;
// some implementations serve statuses on different urls than their AP id // some implementations serve statuses on different urls than their AP id

View file

@ -19,11 +19,7 @@ pub async fn view(
Path(id): Path<String>, Path(id): Path<String>,
Query(query): Query<TryFetch>, Query(query): Query<TryFetch>,
) -> crate::Result<JsonLD<serde_json::Value>> { ) -> crate::Result<JsonLD<serde_json::Value>> {
let uid = if id.starts_with('+') { let uid = ctx.uri("users", id.clone());
format!("https://{}", id.replacen('+', "", 1).replace('@', "/"))
} else {
ctx.uid(id.clone())
};
if auth.is_local() && query.fetch && !ctx.is_local(&uid) { if auth.is_local() && query.fetch && !ctx.is_local(&uid) {
ctx.fetch_user(&uid).await?; ctx.fetch_user(&uid).await?;
} }