diff --git a/src/server/identity.rs b/src/server/identity.rs index cbd22d0..c1825c3 100644 --- a/src/server/identity.rs +++ b/src/server/identity.rs @@ -48,6 +48,13 @@ pub(crate) async fn resolve_handle( }) }) .ok_or_else(|| { - xrpc::Error::invalid_request("Unable to resolve handle").named("HandleNotFound") + let unresolved = xrpc::Error::invalid_request("Unable to resolve handle"); + // Only a name this server answers for is one it can say does not + // exist. For anyone else's, not knowing is all this means. + if accounts.rules().is_local(&handle) { + unresolved.named("HandleNotFound") + } else { + unresolved + } }) } diff --git a/tests/signup.rs b/tests/signup.rs index dc38359..571dbb9 100644 --- a/tests/signup.rs +++ b/tests/signup.rs @@ -197,9 +197,11 @@ async fn a_handle_nothing_here_holds_is_not_resolved_for_a_client() { let (router, _data, _seen) = server(false).await; for (query, error) in [ + // A name this server hands out, so its absence is an answer. ("handle=nobody.pds.test", "HandleNotFound"), - // Somebody else's domain, which this server has no way to ask about. - ("handle=alice.example.com", "HandleNotFound"), + // Somebody else's domain, which this server has no way to ask about + // and therefore cannot say does not exist. + ("handle=alice.example.com", "InvalidRequest"), ("handle=not%20a%20handle", "InvalidHandle"), ] { let (status, body) = call(