From bbf6c97379b8e81025214728874a5339402948fa Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Fri, 15 May 2026 03:11:33 +0200 Subject: [PATCH] fix: UUID fallback in GET /users/{id} so AP actor URLs resolve for signature verification --- crates/presentation/src/handlers/users.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/presentation/src/handlers/users.rs b/crates/presentation/src/handlers/users.rs index e655c60..1419300 100644 --- a/crates/presentation/src/handlers/users.rs +++ b/crates/presentation/src/handlers/users.rs @@ -32,7 +32,16 @@ pub async fn get_user( OptionalAuthUser(viewer): OptionalAuthUser, headers: HeaderMap, ) -> Result { - let user = get_user_by_username(&*s.users, &username).await?; + // AP actor URLs use the user's UUID (e.g. /users/{uuid}). Fall back to UUID lookup + // so remote servers can fetch the actor JSON for HTTP signature verification. + let user = if let Ok(uuid) = uuid::Uuid::parse_str(&username) { + s.users + .find_by_id(&domain::value_objects::UserId::from_uuid(uuid)) + .await? + .ok_or(ApiError::Domain(domain::errors::DomainError::NotFound))? + } else { + get_user_by_username(&*s.users, &username).await? + }; let accept = headers .get(header::ACCEPT)