diff --git a/book/changelog.md b/book/changelog.md index 3f12e7d0..d552c3fa 100644 --- a/book/changelog.md +++ b/book/changelog.md @@ -153,6 +153,8 @@ This will be the first release of Grapevine since it was forked from Conduit 14. Use trust-dns for all DNS queries, instead of only for SRV records and SRV record targets in server discovery. ([!156](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/156)) +15. Return an error on when attempting to delete a nonexistent local alias. + ([!186](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/186)) ### Fixed diff --git a/src/api/client_server/alias.rs b/src/api/client_server/alias.rs index b2fbcf65..5ec165f5 100644 --- a/src/api/client_server/alias.rs +++ b/src/api/client_server/alias.rs @@ -75,6 +75,13 @@ pub(crate) async fn delete_alias_route( )); } + if services().rooms.alias.resolve_local_alias(&body.room_alias)?.is_none() { + return Err(Error::BadRequest( + ErrorKind::NotFound, + "Alias is not assigned.", + )); + } + if let Some(info) = &body.appservice_info { if !info.aliases.is_match(body.room_alias.as_str()) { return Err(Error::BadRequest(