mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
return an error when attempting to delete a nonexistent local alias
The spec doesn't spell out explicitly that the server should check this, but it does list M_NOT_FOUND "room alias ... not found" as an example error response.
This commit is contained in:
parent
a34bca3986
commit
5f9e85cb49
2 changed files with 9 additions and 0 deletions
|
|
@ -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
|
14. Use trust-dns for all DNS queries, instead of only for SRV records and SRV
|
||||||
record targets in server discovery.
|
record targets in server discovery.
|
||||||
([!156](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/156))
|
([!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
|
### Fixed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 let Some(info) = &body.appservice_info {
|
||||||
if !info.aliases.is_match(body.room_alias.as_str()) {
|
if !info.aliases.is_match(body.room_alias.as_str()) {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue