From b4db819ef8daa583a165aed01eb3d70d98e37fc8 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Tue, 1 Jul 2025 01:42:38 -0400 Subject: Prevent sending messages to deleted channels. I've opted to make it clear in the error message which scenario - deleted vs. non-existant - a channel falls into. This isn't particularly consistent with the rest of the API, so we might need to review this decision later, but it's at least relatively harmless if it's mistaken. (Formally, they're both 404s, so clients that go by error code won't notice.) --- src/channel/handlers/send/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/channel/handlers/send/mod.rs') diff --git a/src/channel/handlers/send/mod.rs b/src/channel/handlers/send/mod.rs index aa241e2..bde39e5 100644 --- a/src/channel/handlers/send/mod.rs +++ b/src/channel/handlers/send/mod.rs @@ -54,7 +54,9 @@ impl IntoResponse for Error { fn into_response(self) -> response::Response { let Self(error) = self; match error { - SendError::ChannelNotFound(_) => NotFound(error).into_response(), + SendError::ChannelNotFound(_) | SendError::ChannelDeleted(_) => { + NotFound(error).into_response() + } SendError::Name(_) | SendError::Database(_) => Internal::from(error).into_response(), } } -- cgit v1.2.3